mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org, "Miroslav Benes" <mbenes@suse.cz>,
	"Joe Lawrence" <joe.lawrence@redhat.com>,
	live-patching@vger.kernel.org, "Petr Mladek" <pmladek@suse.com>,
	"Song Liu" <song@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>
Subject: Re: [PATCH v3 6/9] objtool/klp: Don't match local symbols against exports
Date: Fri, 07 Aug 2026 21:46:11 +0000	[thread overview]
Message-ID: <20260807214611.E16B51F000E9@smtp.kernel.org> (raw)
In-Reply-To: <dafc7c017d1f62e2190a20dc84a52fbfc4c70210.1786138493.git.jpoimboe@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Unexported global symbols that share a name with an export are incorrectly matched against the global exports list, causing misrouted livepatch relocations.
--

--- Patch [6]: [PATCH v3 6/9] objtool/klp: Don't match local symbols against exports ---
commit 91941e947fdde72be13c7760463244a153a175ce
Author: Josh Poimboeuf <jpoimboe@kernel.org>

objtool/klp: Don't match local symbols against exports

This commit updates find_export() in klp-diff.c to ignore local symbols.
This addresses an issue where static functions or variables that share a
name with an export are incorrectly treated as export references during
livepatch generation.

> diff --git a/tools/objtool/klp-diff.c b/tools/objtool/klp-diff.c
> --- a/tools/objtool/klp-diff.c
> +++ b/tools/objtool/klp-diff.c
> @@ -1101,6 +1101,9 @@ static struct export *find_export(struct symbol *sym)
>  {
>  	struct export *export;
>  
> +	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;

[Severity: High]
This is a pre-existing issue, but does this still leave unexported global
symbols vulnerable to incorrect matching?

If a module contains an unexported global symbol that shares its name with
an unrelated exported symbol, it will bypass the is_local_sym() check.

When the module is livepatched and klp-diff processes a relocation to this
internal symbol, find_export() will perform a string match and return the
unrelated export. Would this cause a KLP relocation to incorrectly point to
the external module's export instead of the internal symbol?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1786138493.git.jpoimboe@kernel.org?part=6

  reply	other threads:[~2026-08-07 21:46 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 21:37 [PATCH v3 0/9] objtool/klp: sympos/module/alternative/etc fixes Josh Poimboeuf
2026-08-07 21:37 ` [PATCH v3 1/9] objtool/klp: Fix vmlinux .klp.symid link error for .no_trim_symbol symbols Josh Poimboeuf
2026-08-13 11:16   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2026-08-07 21:37 ` [PATCH v3 2/9] objtool/klp: Fix size of empty special section entries Josh Poimboeuf
2026-08-13 11:16   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2026-08-07 21:37 ` [PATCH v3 3/9] objtool/klp: Ignore replacement offset of empty x86 alternatives Josh Poimboeuf
2026-08-13 11:16   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2026-08-07 21:37 ` [PATCH v3 4/9] objtool/klp: Explicitly disallow patching or referencing init code/data Josh Poimboeuf
2026-08-11 22:32   ` Song Liu
2026-08-13 11:16   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2026-08-07 21:37 ` [PATCH v3 5/9] objtool/klp: Fix cross-module klp relocation section naming Josh Poimboeuf
2026-08-13 11:16   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2026-08-07 21:37 ` [PATCH v3 6/9] objtool/klp: Don't match local symbols against exports Josh Poimboeuf
2026-08-07 21:46   ` sashiko-bot [this message]
2026-08-08 22:27     ` Josh Poimboeuf
2026-08-13 11:16   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2026-08-07 21:37 ` [PATCH v3 7/9] objtool/klp: Allow new references to module exports Josh Poimboeuf
2026-08-13 11:16   ` [tip: objtool/core] " tip-bot2 for Joe Lawrence
2026-08-07 21:37 ` [PATCH v3 8/9] objtool/klp: Fix relocations for EXPORT_SYMBOL_FOR_MODULES() symbols Josh Poimboeuf
2026-08-11 22:36   ` Song Liu
2026-08-13 11:16   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2026-08-14 21:05   ` [PATCH v3 8/9] " Dylan Hatch
2026-08-15  0:18     ` Josh Poimboeuf
2026-08-15  1:25       ` Josh Poimboeuf
2026-08-07 21:37 ` [PATCH v3 9/9] objtool/klp: Fix line numbers in Module.symvers parse errors Josh Poimboeuf
2026-08-11 22:36   ` Song Liu
2026-08-13 11:16   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2026-08-11 20:36 ` [PATCH v3 0/9] objtool/klp: sympos/module/alternative/etc fixes Joe Lawrence

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=20260807214611.E16B51F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --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®