From nobody Sat Feb 7 07:25:44 2026 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8F943358D3 for ; Fri, 23 Jan 2026 10:28:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769164126; cv=none; b=MY3y7vMxM35bkTmrxUAbZzMOZP7wyMIRzOZe3vADWJ1zwJ7NwEhOAP9euY43ausp1rmNEQrmuEJI2TMCI5iPATi4GzFXmbl7XqUOEaRw3TDa/RsPCE/vfei7mXM0Vtv1BKN69G1CbXruI9hgefwcOfwng+DFvQVicDmtXDW+hoE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769164126; c=relaxed/simple; bh=Tpz05bjoELPQv2eF0UefMJbC3tfLCQg5SYsCoLtcvBo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EnMrGMYL9QVGc8C7vnUB0gguPT8h7cpeAI9fj/qLqG/sS7fag/XtVZtZis4BdyxW1q1T23v2s4GZ2gSvPZu7DGV8DSr4t/ffuE7IvPFQU8G6xWQqt+0lWlkMbPxJswlZGmeROQjKhgK86q0lRmzmgxSz2uqITxktXUXf3VErijk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=IQn045fj; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="IQn045fj" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4801d24d91bso22571555e9.2 for ; Fri, 23 Jan 2026 02:28:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1769164123; x=1769768923; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wm5L+uQsZ1ST72VLcpgjOsjeSabHaJSKng460K2rBVU=; b=IQn045fjz883uup81a0GLt6RtZKdoh+E8YqPkUL1p4erQwZlNExejScl5ylLqT1LxG SokFPXth1VRTZIrN1ZAE/+H7BVoxc932/2mPnaA0vN6+hNMvkLyms15QV75TV3Xm2e0P LAJjR0y0yceJ/jWTLcoUjyCgUDbEqYkgu9e0BW/N26WQfQcINyiGI4LZhiL2HF1UMgoe iSfmTRF4eNywK7hSoBGo/cB09y1ZBOVq1yO4ymOlZ+dEvjZ/Zj7//PjLcAH5jn24liS/ /LA4gAkCR9LkIwoPz2auxzlFogucOzEcWcb9mMSQM+7gtsOxOWNvnCoUWbKXS2OthdnL 35rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769164123; x=1769768923; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=wm5L+uQsZ1ST72VLcpgjOsjeSabHaJSKng460K2rBVU=; b=YvI7AiJOzDR6A/eFh1rD3MA161HKD3AgOSVnlv2WL/GNbO+QmH2yarqcSwqVoyCH9/ Xdn+PIpj4Xw4eK6bYd2cVGWv9j7IYUYUXf+7oUQfk33k0Hoc+7ZmMCpMuqWBvLVtZHVX n1SnxUd23na6DjFfeZaUxcnKYIs6T0zdU9NEAYBY2QpAvedRO/B9kDGp5AVL6iiQWKra guTXqcrKZ+opGvNQRxRVoRolEqMQu3AS/FUh1TTCsB5xOxiaSC9yeLwmWlnAjEGQEjgL 0buUiWHDba1s536RGzxClwHenJiCBdyUvqZ9Hmj4AXjHX9sEDv/gcPdsZGoNGTXz+tQj nbCQ== X-Forwarded-Encrypted: i=1; AJvYcCVw/ITDKmYKvS8Rye1DbhkNoOp96xdotYSgTSSS+Tf/254kFElXY07Z0E/enVMqVpDS7cxy2UX5ZHjEeF0=@vger.kernel.org X-Gm-Message-State: AOJu0YzCJZZOc8njlaV8V5mjFnZQrauEGRz57qHtWCNMdmaXsVV/AE57 AJZFVL7TbQxkM8Qu6udWaMgd5NcQV+2XtxE8Qdcxq4NSF2vgv60JYarlCF2B8K0Fw8U= X-Gm-Gg: AZuq6aKLQwKUfmOvNkXAdTb4ctUuyYIo9ew1jKKwQaFkFIlfria1j7qmgsvdTJmLUKU hn+Evdr+VuWKXyNr8N7Qqkn+5MKrUvXSetZZ8CJajjeTd8jny3qF2e2gTMVLI2UQY20wB8puFZL 7DDHbpcztS+pJJnfsVUI/X1qlBTg+CtpyPhMCT9TKzXMm9eTL5VclgjKyAlTIpTKEuU86vxEt9K Er6iOWcnZgjdQcLLp4jmzRCG3v5lsfeqI2mpuCOQPckMRxHi8kMvvK3qSA/5E6Zfr6SNub9/7+p 44OS0u6MkkuTCO5zJYKcuZMTUK2yBw5UMCpNMfWQlbNigoLKEdiHCZy413MRnqwOyqHge54+Qms 7liHFEj1Z+dqC9IOAFgioH8Fl9Rdoc+g2HGkbPByZteh9LAarWPKO9/w2P5qOj2+Sq+uD/N6c4E KbhNikiI29lI3GNkk0OGAOGKPnhGLGIys= X-Received: by 2002:a05:600c:a00d:b0:477:a246:8398 with SMTP id 5b1f17b1804b1-4804c947d28mr43761945e9.2.1769164123303; Fri, 23 Jan 2026 02:28:43 -0800 (PST) Received: from zovi.suse.cz (109-81-1-107.rct.o2.cz. [109.81.1.107]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-480470474cbsm128920065e9.8.2026.01.23.02.28.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jan 2026 02:28:43 -0800 (PST) From: Petr Pavlu To: Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence Cc: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Peter Zijlstra , live-patching@vger.kernel.org, linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/2] livepatch: Fix having __klp_objects relics in non-livepatch modules Date: Fri, 23 Jan 2026 11:26:56 +0100 Message-ID: <20260123102825.3521961-2-petr.pavlu@suse.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260123102825.3521961-1-petr.pavlu@suse.com> References: <20260123102825.3521961-1-petr.pavlu@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The linker script scripts/module.lds.S specifies that all input __klp_objects sections should be consolidated into an output section of the same name, and start/stop symbols should be created to enable scripts/livepatch/init.c to locate this data. This start/stop pattern is not ideal for modules because the symbols are created even if no __klp_objects input sections are present. Consequently, a dummy __klp_objects section also appears in the resulting module. This unnecessarily pollutes non-livepatch modules. Instead, since modules are relocatable files, the usual method for locating consolidated data in a module is to read its section table. This approach avoids the aforementioned problem. The klp_modinfo already stores a copy of the entire section table with the final addresses. Introduce a helper function that scripts/livepatch/init.c can call to obtain the location of the __klp_objects section from this data. Signed-off-by: Petr Pavlu Acked-by: Joe Lawrence Acked-by: Josh Poimboeuf Acked-by: Miroslav Benes Reviewed-by: Aaron Tomlin --- include/linux/livepatch.h | 3 +++ kernel/livepatch/core.c | 19 +++++++++++++++++++ scripts/livepatch/init.c | 20 +++++++++----------- scripts/module.lds.S | 7 +------ 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h index 772919e8096a..ba9e3988c07c 100644 --- a/include/linux/livepatch.h +++ b/include/linux/livepatch.h @@ -175,6 +175,9 @@ int klp_enable_patch(struct klp_patch *); int klp_module_coming(struct module *mod); void klp_module_going(struct module *mod); =20 +void *klp_find_section_by_name(const struct module *mod, const char *name, + size_t *sec_size); + void klp_copy_process(struct task_struct *child); void klp_update_patch_state(struct task_struct *task); =20 diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index 9917756dae46..1acbad2dbfdf 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c @@ -1356,6 +1356,25 @@ void klp_module_going(struct module *mod) mutex_unlock(&klp_mutex); } =20 +void *klp_find_section_by_name(const struct module *mod, const char *name, + size_t *sec_size) +{ + struct klp_modinfo *info =3D mod->klp_info; + + for (int i =3D 1; i < info->hdr.e_shnum; i++) { + Elf_Shdr *shdr =3D &info->sechdrs[i]; + + if (!strcmp(info->secstrings + shdr->sh_name, name)) { + *sec_size =3D shdr->sh_size; + return (void *)shdr->sh_addr; + } + } + + *sec_size =3D 0; + return NULL; +} +EXPORT_SYMBOL_GPL(klp_find_section_by_name); + static int __init klp_init(void) { klp_root_kobj =3D kobject_create_and_add("livepatch", kernel_kobj); diff --git a/scripts/livepatch/init.c b/scripts/livepatch/init.c index 2274d8f5a482..9e315fc857bd 100644 --- a/scripts/livepatch/init.c +++ b/scripts/livepatch/init.c @@ -9,19 +9,19 @@ #include #include =20 -extern struct klp_object_ext __start_klp_objects[]; -extern struct klp_object_ext __stop_klp_objects[]; - static struct klp_patch *patch; =20 static int __init livepatch_mod_init(void) { + struct klp_object_ext *obj_exts; + size_t obj_exts_sec_size; struct klp_object *objs; unsigned int nr_objs; int ret; =20 - nr_objs =3D __stop_klp_objects - __start_klp_objects; - + obj_exts =3D klp_find_section_by_name(THIS_MODULE, "__klp_objects", + &obj_exts_sec_size); + nr_objs =3D obj_exts_sec_size / sizeof(*obj_exts); if (!nr_objs) { pr_err("nothing to patch!\n"); ret =3D -EINVAL; @@ -41,7 +41,7 @@ static int __init livepatch_mod_init(void) } =20 for (int i =3D 0; i < nr_objs; i++) { - struct klp_object_ext *obj_ext =3D __start_klp_objects + i; + struct klp_object_ext *obj_ext =3D obj_exts + i; struct klp_func_ext *funcs_ext =3D obj_ext->funcs; unsigned int nr_funcs =3D obj_ext->nr_funcs; struct klp_func *funcs =3D objs[i].funcs; @@ -90,12 +90,10 @@ static int __init livepatch_mod_init(void) =20 static void __exit livepatch_mod_exit(void) { - unsigned int nr_objs; - - nr_objs =3D __stop_klp_objects - __start_klp_objects; + struct klp_object *obj; =20 - for (int i =3D 0; i < nr_objs; i++) - kfree(patch->objs[i].funcs); + klp_for_each_object_static(patch, obj) + kfree(obj->funcs); =20 kfree(patch->objs); kfree(patch); diff --git a/scripts/module.lds.S b/scripts/module.lds.S index 3037d5e5527c..383d19beffb4 100644 --- a/scripts/module.lds.S +++ b/scripts/module.lds.S @@ -35,12 +35,7 @@ SECTIONS { __patchable_function_entries : { *(__patchable_function_entries) } =20 __klp_funcs 0: ALIGN(8) { KEEP(*(__klp_funcs)) } - - __klp_objects 0: ALIGN(8) { - __start_klp_objects =3D .; - KEEP(*(__klp_objects)) - __stop_klp_objects =3D .; - } + __klp_objects 0: ALIGN(8) { KEEP(*(__klp_objects)) } =20 #ifdef CONFIG_ARCH_USES_CFI_TRAPS __kcfi_traps : { KEEP(*(.kcfi_traps)) } --=20 2.52.0 From nobody Sat Feb 7 07:25:44 2026 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C973E2777EA for ; Fri, 23 Jan 2026 10:28:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769164127; cv=none; b=RWn3k+G6oNJ+pHVPmKtMKGcfPV8pqmHC3IWZv2oP812yfANHB59jqQs1GacC3JKypsrptW4ru5vcyNcwI94u6PYnDMGGMGfyfcWHVUlQfhRIImAbU82vpf1+5kO5EYJ+DYOmpc735rxUi5V0ytm209iFJCsu3SQ4LwC3vlcaY9g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769164127; c=relaxed/simple; bh=DtOADswTq9t7oM1NSkiyrF+jafF+Tp/877w6zEpUQhU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pdue8VDzeDylkOT9NsGT0JMjVTyAMqim1nGGgPEDfiHtMNC+c3XEgEki0dFzYS4R9CzaolH7cPlJjqVUhoRnKhjILUSZapvB9id5fl5xk0RXEefrQml2XcUn5Vgmz41ZqfjpgZ1ZrF1Hkbatk9TdbviVyINHthNaUxDmi0F6e5k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=fFcxQwta; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="fFcxQwta" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-47ee3a63300so23430635e9.2 for ; Fri, 23 Jan 2026 02:28:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1769164124; x=1769768924; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZxfRVP7W+3lq5s1e+n6bpoYt/Dv/ToAFRdoKHsTj1cI=; b=fFcxQwtaDCazpAceKn6XtsiQQztngTZvmNRaK0nF+1JeAPAatfdkhiNkOYR1RaE7M1 IlmkgeaXWIGP5X2YAyca3HUIiwVqwox7mnkNfJrH7sHAOlHsbMeP8EyJcGE3t8YgWjpQ R3WjtlkNCDpxhvMDZucoIP1hzikr/5KyjvfkfmJDUQW0Sky3LsFYq3Oq32qFLvPZrlLi iEpNA6YKjgt/RGMjPTMdvuSi2jEhHF34tpSHy/32LlgeijvjzgiqlIDLsvKrBGODY5j8 JPOjf9/qiV5Avbtx7snuiw9y3ayVG7ZBxzKRx4zcQIaN/pMaHOqucc5zBHRyxe85z0kJ QDzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769164124; x=1769768924; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZxfRVP7W+3lq5s1e+n6bpoYt/Dv/ToAFRdoKHsTj1cI=; b=pxZ/9OftLXMBzCsYD3MpXtGLe0RsSeZkhwf+YO54MNykRGhZP6rEYu3FNjXXii3C9O BvF7xqSbwhLS8loLTWE8zhtKUgrn+dT6hGL/Bjs7nu1AXn3MR83WpP94AnO/pV+rM0FJ 3MGmhvabNtXHwrrJlSZKe3wKuhB9zElphtXHMGOPujaamiQEblTji3BBeUbKPblmot2Z odpLsbP/VLq0Lwt38b0rGREOr9FgcgFcF/bGwICN6idNh4QPYCujVOY9WREG+PKn6JbS prRq33Q5PZVkfLmLEWPDm6qa6WyjzgqNevvTKUssM5bUWT80y30Y1MHHUDvAJLEZtLnz h2SQ== X-Forwarded-Encrypted: i=1; AJvYcCVYg9TXK0kvcgwdiRC8lFzhtxjR9gfGvjNWKF8bK74W7vuKbl+J3r+MTeynd6l+XNNqCCo+vQljAj9/apw=@vger.kernel.org X-Gm-Message-State: AOJu0YwGAyAnZkX1JAmc1Jv0JR9wBXHz1dy4J8pcE96jSiIxQ6MPY6mt FJbAjXqZ7EBcv31MVCTf6LRZTK+lEdEkZRc2RKw24l6zGu9LQFejAh+6jQYQkz/E2No= X-Gm-Gg: AZuq6aI6qbnXWTyJM/7Gum/XQdanz1ZUNrEagXdHew2MWTQOngIT0IBYnddRRu9uG/l xO7VlbqLIz/F8MJdcugoGLNkn2gp3DYPKhpww6ahCbsCxwc1QvoM6jW/5J6tpkPmOJKjEup356w IOTz9T5trL895G+l3ACISyjRAT69TUSqM5dS/i8asKPzYI6NCLPBo4tpfgrp1spTJFEGzz10rUx 497Kju8TtSMIOlmyZyqOxkaR/j+hLcz4YiP97MVIyjtHXlEGK52MQN7ruHh8s13Ryjx2jc9SwTX EPzKLV5ygBb1PLGmkpYEH+PlgiCd82ccqFc+/ZkHTpQiuTgAgBrIESdBndBCRLmSKuvEf/gSAHj aVV+8QQWjLUtplrX1z3FazBYjM4mcF5+A0lLJe6bFN2VhNOudqsW9TArvWfG5fgjP0lj2DFF60C 6ZIkXZih8rgVmSyVkNrXChRxB//5CzkOQ= X-Received: by 2002:a05:600c:6814:b0:477:54cd:200e with SMTP id 5b1f17b1804b1-4804c947d18mr42348725e9.1.1769164124202; Fri, 23 Jan 2026 02:28:44 -0800 (PST) Received: from zovi.suse.cz (109-81-1-107.rct.o2.cz. [109.81.1.107]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-480470474cbsm128920065e9.8.2026.01.23.02.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jan 2026 02:28:43 -0800 (PST) From: Petr Pavlu To: Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence Cc: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Peter Zijlstra , live-patching@vger.kernel.org, linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/2] livepatch: Free klp_{object,func}_ext data after initialization Date: Fri, 23 Jan 2026 11:26:57 +0100 Message-ID: <20260123102825.3521961-3-petr.pavlu@suse.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260123102825.3521961-1-petr.pavlu@suse.com> References: <20260123102825.3521961-1-petr.pavlu@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The klp_object_ext and klp_func_ext data, which are stored in the __klp_objects and __klp_funcs sections, respectively, are not needed after they are used to create the actual klp_object and klp_func instances. This operation is implemented by the init function in scripts/livepatch/init.c. Prefix the two sections with ".init" so they are freed after the module is initializated. Signed-off-by: Petr Pavlu Acked-by: Joe Lawrence Acked-by: Josh Poimboeuf Acked-by: Miroslav Benes Reviewed-by: Aaron Tomlin --- scripts/livepatch/init.c | 2 +- scripts/module.lds.S | 4 ++-- tools/objtool/check.c | 2 +- tools/objtool/include/objtool/klp.h | 10 +++++----- tools/objtool/klp-diff.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/livepatch/init.c b/scripts/livepatch/init.c index 9e315fc857bd..638c95cffe76 100644 --- a/scripts/livepatch/init.c +++ b/scripts/livepatch/init.c @@ -19,7 +19,7 @@ static int __init livepatch_mod_init(void) unsigned int nr_objs; int ret; =20 - obj_exts =3D klp_find_section_by_name(THIS_MODULE, "__klp_objects", + obj_exts =3D klp_find_section_by_name(THIS_MODULE, ".init.klp_objects", &obj_exts_sec_size); nr_objs =3D obj_exts_sec_size / sizeof(*obj_exts); if (!nr_objs) { diff --git a/scripts/module.lds.S b/scripts/module.lds.S index 383d19beffb4..054ef99e8288 100644 --- a/scripts/module.lds.S +++ b/scripts/module.lds.S @@ -34,8 +34,8 @@ SECTIONS { =20 __patchable_function_entries : { *(__patchable_function_entries) } =20 - __klp_funcs 0: ALIGN(8) { KEEP(*(__klp_funcs)) } - __klp_objects 0: ALIGN(8) { KEEP(*(__klp_objects)) } + .init.klp_funcs 0 : ALIGN(8) { KEEP(*(.init.klp_funcs)) } + .init.klp_objects 0 : ALIGN(8) { KEEP(*(.init.klp_objects)) } =20 #ifdef CONFIG_ARCH_USES_CFI_TRAPS __kcfi_traps : { KEEP(*(.kcfi_traps)) } diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 3f7999317f4d..933868ee3beb 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4761,7 +4761,7 @@ static int validate_ibt(struct objtool_file *file) !strcmp(sec->name, "__bug_table") || !strcmp(sec->name, "__ex_table") || !strcmp(sec->name, "__jump_table") || - !strcmp(sec->name, "__klp_funcs") || + !strcmp(sec->name, ".init.klp_funcs") || !strcmp(sec->name, "__mcount_loc") || !strcmp(sec->name, ".llvm.call-graph-profile") || !strcmp(sec->name, ".llvm_bb_addr_map") || diff --git a/tools/objtool/include/objtool/klp.h b/tools/objtool/include/ob= jtool/klp.h index ad830a7ce55b..e32e5e8bc631 100644 --- a/tools/objtool/include/objtool/klp.h +++ b/tools/objtool/include/objtool/klp.h @@ -6,12 +6,12 @@ #define SHN_LIVEPATCH 0xff20 =20 /* - * __klp_objects and __klp_funcs are created by klp diff and used by the p= atch - * module init code to build the klp_patch, klp_object and klp_func structs - * needed by the livepatch API. + * .init.klp_objects and .init.klp_funcs are created by klp diff and used = by the + * patch module init code to build the klp_patch, klp_object and klp_func + * structs needed by the livepatch API. */ -#define KLP_OBJECTS_SEC "__klp_objects" -#define KLP_FUNCS_SEC "__klp_funcs" +#define KLP_OBJECTS_SEC ".init.klp_objects" +#define KLP_FUNCS_SEC ".init.klp_funcs" =20 /* * __klp_relocs is an intermediate section which are created by klp diff a= nd diff --git a/tools/objtool/klp-diff.c b/tools/objtool/klp-diff.c index 4d1f9e9977eb..fd64d5e3c3b6 100644 --- a/tools/objtool/klp-diff.c +++ b/tools/objtool/klp-diff.c @@ -1439,7 +1439,7 @@ static int clone_special_sections(struct elfs *e) } =20 /* - * Create __klp_objects and __klp_funcs sections which are intermediate + * Create .init.klp_objects and .init.klp_funcs sections which are interme= diate * sections provided as input to the patch module's init code for building= the * klp_patch, klp_object and klp_func structs for the livepatch API. */ --=20 2.52.0