Re: [PATCH 4/4] objtool/klp: strip klp-induced module dependencies from livepatch modules

Josh Poimboeuf <[email protected]> Sun, 2 Aug 2026 20:06:12 -0700
Newsgroups org.kernel.vger.live-patching
Message-ID <7r7l7impvs5y2lgx3mjfo2wmgmtsbjla3qiu3dtpor3xrlvf4g@lmci63zeujzb>
On Mon, Jul 20, 2026 at 10:56:58AM -0400, Joe Lawrence wrote:
> The klp-diff pipeline creates weak UNDEF placeholder symbols for
> cross-module references that will become klp-relocations.  When modpost
> runs on the linked livepatch .ko, it sees these UNDEF symbols, resolves
> them via Module.symvers, and adds the providing modules to the depends=
> field in .modinfo.
> 
> These dependencies are unnecessary: klp-relocations are resolved by the
> livepatch infrastructure at patch-enable time, not by the module loader.
> Adding hard module dependencies defeats late-module patching, since the
> kernel will refuse to load the livepatch module unless all depended
> modules are already present.
> 
> Fix this by having klp-post-link strip any depends= entry that is only
> the result of klp-symbol (.klp.sym.<mod>.*).  The check is conservative:
> if any remaining SHN_UNDEF symbol matches a known export name from that
> module, the dependency is kept (indicating a legitimate non-KLP
> reference).
> 
> Assisted-by: Claude:claude-opus-4-6
> Signed-off-by: Joe Lawrence <[email protected]>

This patch is no longer needed in light of my tombstone patch which
should prevent modpost from adding those module dependencies in the
first place.

-- 
Josh