Linux Modules
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Josh Poimboeuf" <jpoimboe@kernel.org>
Cc: linux-modules@vger.kernel.org
Subject: Re: [PATCH 08/14] objtool/klp,livepatch: Resolve module symbols against core kallsyms
Date: Mon, 03 Aug 2026 03:53:15 +0000	[thread overview]
Message-ID: <20260803035315.EC8B91F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <5f7b6798592b20c6b4accb725ba87849f3224f2c.1785727106.git.jpoimboe@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] objtool's mod_sym_in_kallsyms() diverges from the kernel's is_core_symbol() logic on PowerPC 64, leading to incorrect sympos calculation for livepatches.
--

--- Patch [8]: [PATCH 08/14] objtool/klp,livepatch: Resolve module symbols against core kallsyms ---
commit 5384e2809ccb86e9339029bde934f86f745e7b61
Author: Josh Poimboeuf <jpoimboe@kernel.org>

objtool/klp,livepatch: Resolve module symbols against core kallsyms

This commit updates livepatch to use a module's position in the core symbol
table as its sympos. It enforces this by using
module_kallsyms_on_each_core_symbol() at runtime and mirroring the
is_core_symbol() filter in objtool.

> diff --git a/tools/objtool/klp-sympos.c b/tools/objtool/klp-sympos.c
> index bbfae516d3395..34bb8d1971bd2 100644
> --- a/tools/objtool/klp-sympos.c
> +++ b/tools/objtool/klp-sympos.c
> @@ -367,6 +367,17 @@ static unsigned long find_vmlinux_sympos(struct symbol *sym)
>  	return sympos;
>  }
>  
> +static bool mod_sym_in_kallsyms(struct symbol *sym)
> +{
> +	if (is_undef_sym(sym))
> +		return false;
> +
> +	if (!(sym->sec->sh.sh_flags & SHF_ALLOC))
> +		return false;
> +
> +	return !strstarts(sym->sec->name, ".init");

[Severity: Medium]
Will this hardcoded filter improperly exclude .init symbols on PowerPC 64?

On PowerPC 64, module_init_section() unconditionally returns false, meaning
the kernel treats .init sections as core memory. This hardcoded string
matching appears to diverge from the kernel's is_core_symbol() logic on
that architecture, potentially leading to incorrect sympos calculations for
livepatches if an object contains duplicate symbols where at least one
resides in an .init section.

> +}

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

  reply	other threads:[~2026-08-03  3:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03  3:24 [PATCH 00/14] objtool/klp: sympos/module/alternative/etc fixes Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 01/14] objtool/klp: Fix module name normalization for paths with dots Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 02/14] objtool/klp: Normalize Module.symvers paths to module names Josh Poimboeuf
2026-08-03  3:37   ` sashiko-bot
2026-08-03  5:37     ` Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 03/14] objtool/klp: Fix false module dependencies caused by dead relocs Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 04/14] objtool/klp: Skip hidden directories when finding objects Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 05/14] objtool/klp: Add .klp.symid for sympos disambiguation Josh Poimboeuf
2026-08-03  3:41   ` sashiko-bot
2026-08-03  5:42     ` Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 06/14] objtool/klp: Fix symbol resolution for duplicate data symbols Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 07/14] module: Add module_kallsyms_on_each_core_symbol() Josh Poimboeuf
2026-08-03  6:24   ` Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 08/14] objtool/klp,livepatch: Resolve module symbols against core kallsyms Josh Poimboeuf
2026-08-03  3:53   ` sashiko-bot [this message]
2026-08-03  6:26   ` Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 09/14] objtool/klp: Fix size of empty special section entries Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 10/14] objtool/klp: Ignore replacement offset of empty x86 alternatives Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 11/14] objtool/klp: Explicitly disallow patching or referencing init code/data Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 12/14] objtool/klp: Fix cross-module klp relocation section naming Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 13/14] objtool/klp: Don't match local symbols against exports Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 14/14] objtool/klp: Allow new references to module exports Josh Poimboeuf

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=20260803035315.EC8B91F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=jpoimboe@kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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