From: "tip-bot2 for Josh Poimboeuf" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Joe Lawrence <joe.lawrence@redhat.com>,
Song Liu <song@kernel.org>, Josh Poimboeuf <jpoimboe@kernel.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: objtool/core] objtool/klp: Fix .kcfi_traps special section extraction
Date: Thu, 13 Aug 2026 11:16:18 -0000 [thread overview]
Message-ID: <178661977895.442315.13901337694986881766.tip-bot2@tip-bot2> (raw)
In-Reply-To: <8faaead205b219607b6fc2359ae743be824056eb.1786230311.git.jpoimboe@kernel.org>
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: 7df1638df97b2aaaff4731b72d4940053257c952
Gitweb: https://git.kernel.org/tip/7df1638df97b2aaaff4731b72d4940053257c952
Author: Josh Poimboeuf <jpoimboe@kernel.org>
AuthorDate: Sat, 08 Aug 2026 16:17:05 -07:00
Committer: Josh Poimboeuf <jpoimboe@kernel.org>
CommitterDate: Wed, 12 Aug 2026 13:52:07 -07:00
objtool/klp: Fix .kcfi_traps special section extraction
create_fake_symbols() creates a symbol per entry for special sections.
It does so in two steps: first for the sections which have
ANNOTATE_DATA_SPECIAL annotations, then for the rest, using entsize or
the reloc count to infer the entry size. The second step skips the
sections already handled by the first one by looking for a symbol at
offset 0.
That heuristic is too fuzzy: with Clang and CONFIG_CFI, it misfires on
.kcfi_traps because Clang emits a .Ltmp* assembler-local label at the
start of the section, so no symbols are created and
clone_special_sections() extracts nothing. klp-build still reports
SUCCESS, but the livepatch module has no __kcfi_traps section and the
traps for the patched functions are lost.
Look for the actual fake symbols created by the first step instead.
Fixes: da4326573ae8d ("objtool/klp: Fix kCFI trap handling")
Reported-by: Joe Lawrence <joe.lawrence@redhat.com>
Closes: https://lore.kernel.org/r/akQNqlfFC0T5pcMa@redhat.com
Acked-by: Song Liu <song@kernel.org>
Link: https://patch.msgid.link/8faaead205b219607b6fc2359ae743be824056eb.1786230311.git.jpoimboe@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
tools/objtool/include/objtool/elf.h | 1 +
tools/objtool/klp-diff.c | 26 ++++++++++++++++++++++++--
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h
index d9c44df..a82517a 100644
--- a/tools/objtool/include/objtool/elf.h
+++ b/tools/objtool/include/objtool/elf.h
@@ -97,6 +97,7 @@ struct symbol {
u8 included : 1;
u8 klp : 1;
u8 dont_correlate : 1;
+ u8 fake : 1;
struct list_head pv_target;
struct reloc *relocs;
struct section *group_sec;
diff --git a/tools/objtool/klp-diff.c b/tools/objtool/klp-diff.c
index cdc63ab..a66049e 100644
--- a/tools/objtool/klp-diff.c
+++ b/tools/objtool/klp-diff.c
@@ -1630,6 +1630,7 @@ static int create_fake_symbol(struct elf *elf, struct section *sec,
unsigned long offset, size_t size)
{
char name[SYM_NAME_LEN];
+ struct symbol *sym;
unsigned int type;
static int ctr;
char *c;
@@ -1646,7 +1647,24 @@ static int create_fake_symbol(struct elf *elf, struct section *sec,
* while still allowing objdump to disassemble it.
*/
type = is_text_sec(sec) ? STT_NOTYPE : STT_OBJECT;
- return elf_create_symbol(elf, name, sec, STB_LOCAL, type, offset, size) ? 0 : -1;
+
+ sym = elf_create_symbol(elf, name, sec, STB_LOCAL, type, offset, size);
+ if (!sym)
+ return -1;
+
+ sym->fake = 1;
+ return 0;
+}
+
+static bool has_fake_symbols(struct section *sec)
+{
+ struct symbol *sym;
+
+ sec_for_each_sym(sec, sym)
+ if (sym->fake)
+ return true;
+
+ return false;
}
/*
@@ -1738,7 +1756,11 @@ entsize:
unsigned int entry_size;
unsigned long offset;
- if (!is_special_section(sec) || find_symbol_by_offset(sec, 0))
+ if (!is_special_section(sec))
+ continue;
+
+ /* Skip sections already handled by step 1 above */
+ if (has_fake_symbols(sec))
continue;
if (!sec->rsec) {
next prev parent reply other threads:[~2026-08-13 11:16 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-08 23:17 [PATCH v4 00/22] objtool/arm64: Port klp-build to arm64 Josh Poimboeuf
2026-08-08 23:17 ` [PATCH v4 01/22] objtool/klp: Fix .kcfi_traps special section extraction Josh Poimboeuf
2026-08-11 23:27 ` Song Liu
2026-08-13 11:16 ` tip-bot2 for Josh Poimboeuf [this message]
2026-08-08 23:17 ` [PATCH v4 02/22] klp-build: Reject patches to init/*.c Josh Poimboeuf
2026-08-08 23:17 ` [PATCH v4 03/22] arm64: Annotate intra-function calls Josh Poimboeuf
2026-08-08 23:17 ` [PATCH v4 04/22] arm64: Fix EFI linking with -fdata-sections Josh Poimboeuf
2026-08-08 23:17 ` [PATCH v4 05/22] arm64: Rename TRAMP_VALIAS -> TRAMP_VALIAS_ASM in asm-offsets Josh Poimboeuf
2026-08-08 23:17 ` [PATCH v4 06/22] arm64: vdso: Discard .discard.* sections Josh Poimboeuf
2026-08-11 23:30 ` Song Liu
2026-08-08 23:17 ` [PATCH v4 07/22] arm64: Annotate special section entries Josh Poimboeuf
2026-08-08 23:17 ` [PATCH v4 08/22] arm64: Remove unnecessary empty alternatives Josh Poimboeuf
2026-08-08 23:17 ` [PATCH v4 09/22] crypto: arm64: Move data to .rodata Josh Poimboeuf
2026-08-08 23:17 ` [PATCH v4 10/22] objtool: Allow setting --mnop without --mcount Josh Poimboeuf
2026-08-08 23:17 ` [PATCH v4 11/22] kbuild: Only run objtool if there is at least one command Josh Poimboeuf
2026-08-11 23:40 ` Song Liu
2026-08-08 23:17 ` [PATCH v4 12/22] objtool: Ignore jumps to the end of the function for checksum runs Josh Poimboeuf
2026-08-11 23:41 ` Song Liu
2026-08-08 23:17 ` [PATCH v4 13/22] objtool: Refactor elf_add_data() to use a growable data buffer Josh Poimboeuf
2026-08-11 23:48 ` Song Liu
2026-08-08 23:17 ` [PATCH v4 14/22] objtool: Reuse string references Josh Poimboeuf
2026-08-11 23:52 ` Song Liu
2026-08-12 0:23 ` Josh Poimboeuf
2026-08-08 23:17 ` [PATCH v4 15/22] objtool: Prevent kCFI hashes from being decoded as instructions Josh Poimboeuf
2026-08-11 23:58 ` Song Liu
2026-08-12 0:30 ` Josh Poimboeuf
2026-08-12 4:37 ` Song Liu
2026-08-08 23:17 ` [PATCH v4 16/22] objtool/klp: Add arm64 support for prefix/PFE detection Josh Poimboeuf
2026-08-08 23:17 ` [PATCH v4 17/22] objtool/klp: Filter arm64 mapping symbols in find_symbol_by_offset() Josh Poimboeuf
2026-08-08 23:17 ` [PATCH v4 18/22] objtool/klp: Don't correlate arm64 mapping symbols Josh Poimboeuf
2026-08-12 0:00 ` Song Liu
2026-08-08 23:17 ` [PATCH v4 19/22] objtool/klp: Clone inline alternative replacements Josh Poimboeuf
2026-08-08 23:17 ` [PATCH v4 20/22] objtool/klp: Introduce objtool for arm64 Josh Poimboeuf
2026-08-12 0:01 ` Song Liu
2026-08-08 23:17 ` [PATCH v4 21/22] klp-build: Support cross-compilation Josh Poimboeuf
2026-08-12 0:02 ` Song Liu
2026-08-08 23:17 ` [PATCH v4 22/22] klp-build: Add arm64 syscall patching macro Josh Poimboeuf
2026-08-12 0:02 ` Song Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178661977895.442315.13901337694986881766.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=song@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®