From nobody Wed Sep 30 03:45:57 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 562E9411F9D; Thu, 13 Aug 2026 11:16:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786619787; cv=none; b=gwqHC4ZeVOuTlIk4sHstUN2MNT5bV37vaaUlxToKO3w+nP26rSAjxJBnrhfD92ImaOkkypYkM/tEoE0d1QdUEm+unZtt4c1KDXkIjcRGXsjhusaWXeqoY1cp7LggGGKk1mGrD/801YesvpynPSG5MRSPQjE2n0pgxE9xvAO6SAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786619787; c=relaxed/simple; bh=Uqmet4Ev6R9O51TR6gjgWxyhbi7aNsPRS8m7Tm/u4cM=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=LM35drgRu8a8wZE0auMuPc3cuh1Hj8v5Kcp1LmuH47XaqROecYQc1F6YwPIiJX2fk1Bs8TXSAV4n3C/aZbn9YwZ+VsFSD5o5lIRSIX6EFhftp9p56n8ACVTu7wNjixo4qySD0MM2iHLhupAnTMG6WSfCcGP/mP3dMVvhhV7P+IM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=OC8dWZ4z; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Gk7HdinA; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="OC8dWZ4z"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Gk7HdinA" Date: Thu, 13 Aug 2026 11:16:18 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1786619780; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=25lUJgdnl52/WJj9YcpWtzWMAYcAAYXX1jZMkJhEIVQ=; b=OC8dWZ4zfTTF+Cf5/tLLgeCvuL10kanej9ebAf82xk4YN0IzWqpJSKGxVnDwNDfVfW+/dA z4WWeU7XpH8TKSUszTgoZtsYn8PbNZdy2icgYUQC+Nt5nRt70iUApVxNncXbzEqpJUuWbd fAKaXP8xKNKBJ78pctb8wqj7JhKI3ZyrP2esQIaV2Pe6Y3rAYrHQ1Hn05RvmFQQzn78D4T xi7xMSncRMKU6epWA5aUcHL3nfmDTLNfFNueuK88Yil4t5JvaXXP3R+lONlgu2RmJbr00q EKFB2ETYJAbsFVnPzQNIYuHma+y/nhFNw2TGS30Aq/3aPn0/6aLlohZUEPvjCg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1786619780; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=25lUJgdnl52/WJj9YcpWtzWMAYcAAYXX1jZMkJhEIVQ=; b=Gk7HdinA8mNrfUmo7jVGR0u82cUQUX6HKoc14imI7jyoOtXt6GFJ2+MgjS+08dDcJ4vrrZ Z/qM9iZ0ArgXvhAQ== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] objtool/klp: Fix .kcfi_traps special section extraction Cc: Joe Lawrence , Song Liu , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <8faaead205b219607b6fc2359ae743be824056eb.1786230311.git.jpoimboe@kernel.org> References: <8faaead205b219607b6fc2359ae743be824056eb.1786230311.git.jpoimboe@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178661977895.442315.13901337694986881766.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the objtool/core branch of tip: Commit-ID: 7df1638df97b2aaaff4731b72d4940053257c952 Gitweb: https://git.kernel.org/tip/7df1638df97b2aaaff4731b72d4940053= 257c952 Author: Josh Poimboeuf AuthorDate: Sat, 08 Aug 2026 16:17:05 -07:00 Committer: Josh Poimboeuf 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 Closes: https://lore.kernel.org/r/akQNqlfFC0T5pcMa@redhat.com Acked-by: Song Liu Link: https://patch.msgid.link/8faaead205b219607b6fc2359ae743be824056eb.178= 6230311.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf --- 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/ob= jtool/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, struc= t section *sec, * while still allowing objdump to disassemble it. */ type =3D is_text_sec(sec) ? STT_NOTYPE : STT_OBJECT; - return elf_create_symbol(elf, name, sec, STB_LOCAL, type, offset, size) ?= 0 : -1; + + sym =3D elf_create_symbol(elf, name, sec, STB_LOCAL, type, offset, size); + if (!sym) + return -1; + + sym->fake =3D 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; } =20 /* @@ -1738,7 +1756,11 @@ entsize: unsigned int entry_size; unsigned long offset; =20 - 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; =20 if (!sec->rsec) {