Re: [PATCH 1/1] objtool/klp-diff: normalize Module.symvers paths to module names

Josh Poimboeuf <[email protected]> Wed, 15 Jul 2026 08:52:00 -0700
Newsgroups org.kernel.vger.live-patching
Message-ID <z5gsf64vdad2tr42c53g4umz2hmqiu4ith5b6ezjfvoidfdzfy@34mvdcndk7ro>
On Mon, Jul 13, 2026 at 05:31:28PM -0400, Joe Lawrence wrote:
> Module.symvers contains build-tree object paths as module identifiers
> (e.g., "arch/x86/kvm/kvm") rather than runtime module names ("kvm").
> Objtool's clone_reloc_klp() uses this field directly for exported
> symbols, while unexported symbols correctly go through __find_modname().
> 
> This means that exported symbol relocations may land in a .klp.rela
> section named with the build path rather than the module name.  That is
> a crash waiting to happen: the kernel's livepatch loader silently skips
> this relocation because it doesn't match the expected klp_object name.
> The unresolved relocation sits in the newly activated code, crashing
> when executed.
> 
> Normalize export->mod at Module.symvers read time using the same logic
> as __find_modname() (refactored into a shared normalize_modname()
> helper).
> 
> Fixes: dd590d4d57eb ("objtool/klp: Introduce klp diff subcommand for diffing object files")
> Reported-by: Ben Procknow <[email protected]>
> Signed-off-by: Joe Lawrence <[email protected]>

Looks good, thanks!  I'll queue it up.

-- 
Josh