diff options
| author | Josh Poimboeuf <jpoimboe@kernel.org> | 2025-09-17 09:04:01 -0700 |
|---|---|---|
| committer | Josh Poimboeuf <jpoimboe@kernel.org> | 2025-10-14 14:50:18 -0700 |
| commit | ebe864b55304f74c4e1a8b6c899e34446b2be424 (patch) | |
| tree | 887efac075ae2801857bfa3e34fc336b2d4bf2cc /tools/objtool/include | |
| parent | 7c2575a6406fb85946b05d8dcc856686d3156354 (diff) | |
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>
Diffstat (limited to 'tools/objtool/include')
| -rw-r--r-- | tools/objtool/include/objtool/klp.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/objtool/include/objtool/klp.h b/tools/objtool/include/objtool/klp.h index 07928fac059b..ad830a7ce55b 100644 --- a/tools/objtool/include/objtool/klp.h +++ b/tools/objtool/include/objtool/klp.h @@ -2,6 +2,9 @@ #ifndef _OBJTOOL_KLP_H #define _OBJTOOL_KLP_H +#define SHF_RELA_LIVEPATCH 0x00100000 +#define SHN_LIVEPATCH 0xff20 + /* * __klp_objects and __klp_funcs are created by klp diff and used by the patch * module init code to build the klp_patch, klp_object and klp_func structs @@ -27,5 +30,6 @@ struct klp_reloc { }; int cmd_klp_diff(int argc, const char **argv); +int cmd_klp_post_link(int argc, const char **argv); #endif /* _OBJTOOL_KLP_H */ |
