On Fri, May 09, 2025 at 01:17:18PM -0700, Josh Poimboeuf wrote: > Livepatch needs some ELF magic which linkers don't like: > > - Two relocation sections (.rela*, .klp.rela*) for the same text > section. > > - Use of SHN_LIVEPATCH to mark livepatch symbols. > > Unfortunately linkers tend to mangle such things. To work around that, > klp diff generates a linker-compliant intermediate binary which encodes > the relevant KLP section/reloc/symbol metadata. > > After module linking, the .ko then needs to be converted to an actual > livepatch module. Introduce a new klp post-link subcommand to do so. > > Signed-off-by: Josh Poimboeuf <jpoim...@kernel.org>
FWIW, I have plans to get rid of this post-link step by saying goodbye to "klp relocs" altogether. I have a working PoC which implements livepatch "submodules" which are specific to their target object (vmlinux or module). The top-level livepatch module keeps its submodule .ko binaries in memory (embedded in its private data) and loads/unloads them on demand. The end result looks a lot cleaner. It also removes the restrictions we have today which don't allow references to static call/branch keys which live in modules. That will have to be another patch set though, 63 patches is plenty long enough already. -- Josh