]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
objtool/klp: Add post-link subcommand to finalize livepatch modules
authorJosh Poimboeuf <jpoimboe@kernel.org>
Wed, 17 Sep 2025 16:04:01 +0000 (09:04 -0700)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 14 Oct 2025 21:50:18 +0000 (14:50 -0700)
commitebe864b55304f74c4e1a8b6c899e34446b2be424
tree887efac075ae2801857bfa3e34fc336b2d4bf2cc
parent7c2575a6406fb85946b05d8dcc856686d3156354
objtool/klp: Add post-link subcommand to finalize livepatch modules

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.

Acked-by: Petr Mladek <pmladek@suse.com>
Tested-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
tools/objtool/Build
tools/objtool/builtin-klp.c
tools/objtool/include/objtool/klp.h
tools/objtool/klp-post-link.c [new file with mode: 0644]