From nobody Wed Sep 30 03:45:06 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 59731414A09; Thu, 13 Aug 2026 11:16:31 +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=1786619796; cv=none; b=XVpPSUCo+IX+4oT+nb1n31GpBiIErAkvOnCXVDWdl6GkQNY2vdzVN5JosnDHOfPMYTDyOvLNdaZ3WPHYJZ22aCYdUVr/pzjMdINMozO3wQxg4kjcSEev6ICNrMQOq5enWYbBhxWdztau2tc3a1FVYMjUz/PnAORNYF3qYronKMI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786619796; c=relaxed/simple; bh=Kjq5lztNOTOUeHqF/btyrSMJ0T3NcOMnxPlOZO4CyhU=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=mHVfjiE6WxObgdPhlrhGTT4wAcp+wMugdNrLOv5efsjpxK7/P5CMj3bT1UL0Y2vYdoefQ8UsmKG2OSJKVdFkiUQStDK5Z0ACaluFDcZWqFllwPIxZ7t/DTlq1Mh+dl7h4WeR4LIkor5TjdqFiwx7x1TT09rMqXDhHtirk9WvB2k= 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=lmh3uKY7; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Jnxh+pdc; 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="lmh3uKY7"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Jnxh+pdc" Date: Thu, 13 Aug 2026 11:16:26 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1786619788; 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=YpfNo+cZVhB6m3cquPtu20rpLtKRV+84b0XG+/3OTlo=; b=lmh3uKY7seSNvjb9oXlJDPgRr6HnG3wU/urGdcHY9u3Vzh/ylTWBs8BT2uFYt9OEm9avrq o5Bq0DE1znVWwvjdsmWTv4NBnhMNwqmLYuOs6nMLOg8mYEhgsI3gM2Ws1yZYVJ7mB1rmLR VNEMXsbw8dUt2X8fIxL1aUilnox+585vqoVY3uCq/tzmaxMhQXNcMqVUc4IRh6N+8WFjxC VfGcBXHqk9NBEQp1otLmc8rg3u7zvqz6FrFMyFLDkoV63H8GzrE0aUsDKeyVBzZKPqDvMa 3SvsR+gOF12MWuOUnyZ0pYAOqOZUN36Ohda3JIa0iTKAW9ngBrgaUAfQoEaP1w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1786619788; 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=YpfNo+cZVhB6m3cquPtu20rpLtKRV+84b0XG+/3OTlo=; b=Jnxh+pdcAmfSCIcSsotzfM0JDs6Wyr5oL5edXIyMCFoeKkRxpdKd58esKdC3zTVlC4vSih 5PYP1R40DITUirBA== 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: Don't match local symbols against exports Cc: Song Liu , Joe Lawrence , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178661978658.442315.17609163334994641931.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: 86a697572c6271083694025eefa8de518eeef623 Gitweb: https://git.kernel.org/tip/86a697572c6271083694025eefa8de518= eeef623 Author: Josh Poimboeuf AuthorDate: Fri, 07 Aug 2026 14:37:51 -07:00 Committer: Josh Poimboeuf CommitterDate: Tue, 11 Aug 2026 16:10:51 -07:00 objtool/klp: Don't match local symbols against exports While cloning a reloc, klp diff calls find_export() to determine whether the referenced symbol is exported. That decides whether the reference needs a klp reloc, which object the klp symbol belongs to, and whether the symbol's data needs to be copied into the patch module. But find_export() matches purely on symbol name, so a static function or variable which happens to share its name with an export is mistaken for a reference to that export: - klp_reloc_needed() creates a klp reloc pointing at the exporting module's symbol rather than the local one. For a vmlinux export it skips the klp reloc altogether, leaving a normal reloc which the module loader resolves to the vmlinux symbol. - clone_reloc() treats the symbol as external and clones it without its data, leaving a dangling reference. - validate_special_section_klp_reloc() attributes a static branch or call key to the wrong module, and for a vmlinux export skips the unsupported-key check entirely. Exports are always global, so ignore local symbols in find_export(). 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/dafc7c017d1f62e2190a20dc84a52fbfc4c70210.178= 6138493.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf --- tools/objtool/klp-diff.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/objtool/klp-diff.c b/tools/objtool/klp-diff.c index e266a54..a7cdba0 100644 --- a/tools/objtool/klp-diff.c +++ b/tools/objtool/klp-diff.c @@ -1102,6 +1102,9 @@ static struct export *find_export(struct symbol *sym) { struct export *export; =20 + if (is_local_sym(sym)) + return NULL; + hash_for_each_possible(exports, export, hash, str_hash(sym->name)) { if (!strcmp(export->sym, sym->name)) return export;