Re: [PATCH 08/14] objtool/klp,livepatch: Resolve module symbols against core kallsyms

[email protected] Mon, 03 Aug 2026 03:53:15 +0000
Newsgroups org.kernel.vger.linux-modules
Message-ID <[email protected]>
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_co=
re_symbol() logic on PowerPC 64, leading to incorrect sympos calculation fo=
r livepatches.
--

--- Patch [8]: [PATCH 08/14] objtool/klp,livepatch: Resolve module symbols =
against core kallsyms ---
commit 5384e2809ccb86e9339029bde934f86f745e7b61
Author: Josh Poimboeuf <[email protected]>

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 symb=
ol *sym)
>  	return sympos;
>  }
> =20
> +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.

> +}

--=20
Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1785727106.gi=
[email protected]?part=3D8