From nobody Tue Sep 29 02:01:27 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 AC60738D419; Thu, 13 Aug 2026 11:16:37 +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=1786619800; cv=none; b=tKWF9bts9gTggp/Au0Lvk0FRRtJ4JJdXn250QVKPA+WeTkAn3ZtwPjUgrQQ+MdNjsSJKNiiTr81434+u8cwCg4tOZSFmJBEfvFL4RkBgUC/8flW9esf09aGa54IEOL/TKv1xB4Zq3NaI1APkC+pp9Z7Ia/opapOZuKPBdK4cZFY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786619800; c=relaxed/simple; bh=5fu61C4QHQ8oWxfmDVYqILpjRQBsRhynmOXJ90gT0x8=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=nv8YLdU7/McEVBl28zYJcaPf2XuhVmecHy2Xkd2tKIRbIyPDMDRZNjG5TmpUsGSS+UwEZdFqlSAmAw4jEy3Q82S53U+RR4Vz0BeKGcN4osD1tSTIdWqx9nFy9NwrE7lOJJNWOwaIJVg5Q+1+7pEKYQXMQ2tUM1BLf2fRXvMIivU= 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=USjgUtb0; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=SiJ6luuq; 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="USjgUtb0"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="SiJ6luuq" Date: Thu, 13 Aug 2026 11:16:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1786619794; 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=0iRr6kGgDYk6igML7iaJ6vUie02/z1Td701c1WUoDek=; b=USjgUtb0myU/dkj0fBQT/lEMuNFAkDfYfpeo4ZUhlTM6mJ3ny4hVVm+1V8e+CjNkqjTZjp HRGfy+rB5//7G5yCSEXMdk9vwNDi3vqsZ+L72auPXbhuvbsR9M0tLbQkkVqUAPhMDA9qfw t8bL4GTRoMf42HHiHEAAwAglLi/Nact8Buz6MWj8teP/dZrN0Ue3JqCG2wMcYEdBuIv0V+ wyY8020F9LrPfN5TqClFcwkIGu75CtZ4k7/zCrUw3+4Mv1foTxJKX3GA3167OyWKZY3wJt x9XoCdQbdKV85pBsETIBrF75MBoMvJQg36iazFTxkjACvW8XlEvf4hxSiP0Nrg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1786619794; 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=0iRr6kGgDYk6igML7iaJ6vUie02/z1Td701c1WUoDek=; b=SiJ6luuqbFnFoP5azr3Jj2HCTERshgFLqoUEu9vUCNBUk+cEYvgnEWK/owFRYRKWquL9w3 0wqAf/dTz0GThDDQ== 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 size of empty special section entries Cc: Song Liu , Joe Lawrence , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <913e691c5009397df832c7c9a18cd5cf71b42737.1786138493.git.jpoimboe@kernel.org> References: <913e691c5009397df832c7c9a18cd5cf71b42737.1786138493.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: <178661979269.442315.15171630513543466293.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: 1ea786097cd79522b76cbd41beeb8f84ef3a76f4 Gitweb: https://git.kernel.org/tip/1ea786097cd79522b76cbd41beeb8f84e= f3a76f4 Author: Josh Poimboeuf AuthorDate: Fri, 07 Aug 2026 14:37:47 -07:00 Committer: Josh Poimboeuf CommitterDate: Tue, 11 Aug 2026 15:04:57 -07:00 objtool/klp: Fix size of empty special section entries create_fake_symbols() sizes each ANNOTATE_DATA_SPECIAL entry from the offset of the next annotation, falling back to the end of the section for the last entry. But the last entry is detected by a zero size, which also happens for an *empty* entry: ALTERNATIVE(oldinstr, "", ft) still annotates its zero-length replacement, at the same offset as the next entry's annotation. So every empty replacement gets a fake symbol spanning the entire rest of .altinstr_replacement. That's harmless today only because find_symbol_containing() picks the smaller of two overlapping symbols. Track whether a next annotation was found rather than inferring it from the size. A zero-length fake symbol is fine: find_symbol_containing() skips those, so the properly sized symbol at the same offset still wins. Fixes: dd590d4d57eb ("objtool/klp: Introduce klp diff subcommand for diffin= g object files") Acked-by: Song Liu Acked-by: Joe Lawrence Link: https://patch.msgid.link/913e691c5009397df832c7c9a18cd5cf71b42737.178= 6138493.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf --- tools/objtool/klp-diff.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/objtool/klp-diff.c b/tools/objtool/klp-diff.c index c5284d2..b4220e1 100644 --- a/tools/objtool/klp-diff.c +++ b/tools/objtool/klp-diff.c @@ -1628,13 +1628,17 @@ static int create_fake_symbols(struct elf *elf) for_each_reloc(sec->rsec, reloc) { unsigned long offset, size; struct reloc *next_reloc; + bool last =3D true; =20 if (annotype(elf, sec, reloc) !=3D ANNOTYPE_DATA_SPECIAL) continue; =20 offset =3D reloc_addend(reloc); =20 - size =3D 0; + /* + * Find the start of the next entry so the fake symbol size can + * be calculated. + */ next_reloc =3D reloc; for_each_reloc_continue(sec->rsec, next_reloc) { if (annotype(elf, sec, next_reloc) !=3D ANNOTYPE_DATA_SPECIAL || @@ -1642,10 +1646,15 @@ static int create_fake_symbols(struct elf *elf) continue; =20 size =3D reloc_addend(next_reloc) - offset; + last =3D false; break; } =20 - if (!size) + /* + * If no next entry found, this is the last entry, so its size + * is from the current offset to the end of the section. + */ + if (last) size =3D sec_size(reloc->sym->sec) - offset; =20 if (create_fake_symbol(elf, reloc->sym->sec, offset, size))