| b525fcaf | 23-Jan-2026 |
Petr Pavlu <petr.pavlu@suse.com> |
livepatch: Free klp_{object,func}_ext data after initialization
The klp_object_ext and klp_func_ext data, which are stored in the __klp_objects and __klp_funcs sections, respectively, are not needed
livepatch: Free klp_{object,func}_ext data after initialization
The klp_object_ext and klp_func_ext data, which are stored in the __klp_objects and __klp_funcs sections, respectively, are not needed after they are used to create the actual klp_object and klp_func instances. This operation is implemented by the init function in scripts/livepatch/init.c.
Prefix the two sections with ".init" so they are freed after the module is initializated.
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Acked-by: Miroslav Benes <mbenes@suse.cz> Reviewed-by: Aaron Tomlin <atomlin@atomlin.com> Link: https://patch.msgid.link/20260123102825.3521961-3-petr.pavlu@suse.com Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| ab108154 | 23-Jan-2026 |
Petr Pavlu <petr.pavlu@suse.com> |
livepatch: Fix having __klp_objects relics in non-livepatch modules
The linker script scripts/module.lds.S specifies that all input __klp_objects sections should be consolidated into an output secti
livepatch: Fix having __klp_objects relics in non-livepatch modules
The linker script scripts/module.lds.S specifies that all input __klp_objects sections should be consolidated into an output section of the same name, and start/stop symbols should be created to enable scripts/livepatch/init.c to locate this data.
This start/stop pattern is not ideal for modules because the symbols are created even if no __klp_objects input sections are present. Consequently, a dummy __klp_objects section also appears in the resulting module. This unnecessarily pollutes non-livepatch modules.
Instead, since modules are relocatable files, the usual method for locating consolidated data in a module is to read its section table. This approach avoids the aforementioned problem.
The klp_modinfo already stores a copy of the entire section table with the final addresses. Introduce a helper function that scripts/livepatch/init.c can call to obtain the location of the __klp_objects section from this data.
Fixes: dd590d4d57eb ("objtool/klp: Introduce klp diff subcommand for diffing object files") Signed-off-by: Petr Pavlu <petr.pavlu@suse.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Acked-by: Miroslav Benes <mbenes@suse.cz> Reviewed-by: Aaron Tomlin <atomlin@atomlin.com> Link: https://patch.msgid.link/20260123102825.3521961-2-petr.pavlu@suse.com Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| a8ff29f0 | 28-Jan-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
livepatch/klp-build: Require Clang assembler >= 20
Some special sections specify their ELF section entsize, for example:
.pushsection section, "M", @progbits, 8
The entsize (8 in this example) i
livepatch/klp-build: Require Clang assembler >= 20
Some special sections specify their ELF section entsize, for example:
.pushsection section, "M", @progbits, 8
The entsize (8 in this example) is needed by objtool klp-diff for extracting individual entries.
Clang assembler versions older than 20 silently ignore the above construct and set entsize to 0, resulting in the following error:
.discard.annotate_data: missing special section entsize or annotations
Add a klp-build check to prevent the use of Clang assembler versions prior to 20.
Fixes: 24ebfcd65a87 ("livepatch/klp-build: Introduce klp-build script for generating livepatch modules") Reported-by: Song Liu <song@kernel.org> Acked-by: Song Liu <song@kernel.org> Link: https://patch.msgid.link/957fd52e375d0e2cfa3ac729160da995084a7f5e.1769562556.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| 78be9fac | 17-Sep-2025 |
Josh Poimboeuf <jpoimboe@kernel.org> |
livepatch/klp-build: Add --show-first-changed option to show function divergence
Add a --show-first-changed option to identify where changed functions begin to diverge:
- Parse 'objtool klp diff'
livepatch/klp-build: Add --show-first-changed option to show function divergence
Add a --show-first-changed option to identify where changed functions begin to diverge:
- Parse 'objtool klp diff' output to find changed functions.
- Run objtool again on each object with --debug-checksum=<funcs>.
- Diff the per-instruction checksum debug output to locate the first differing instruction.
This can be useful for quickly determining where and why a function changed.
Acked-by: Petr Mladek <pmladek@suse.com> Tested-by: Joe Lawrence <joe.lawrence@redhat.com> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| 2c2f0b86 | 17-Sep-2025 |
Josh Poimboeuf <jpoimboe@kernel.org> |
livepatch/klp-build: Add --debug option to show cloning decisions
Add a --debug option which gets passed to "objtool klp diff" to enable debug output related to cloning decisions.
Acked-by: Petr Ml
livepatch/klp-build: Add --debug option to show cloning decisions
Add a --debug option which gets passed to "objtool klp diff" to enable debug output related to cloning decisions.
Acked-by: Petr Mladek <pmladek@suse.com> Tested-by: Joe Lawrence <joe.lawrence@redhat.com> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| 24ebfcd6 | 17-Sep-2025 |
Josh Poimboeuf <jpoimboe@kernel.org> |
livepatch/klp-build: Introduce klp-build script for generating livepatch modules
Add a klp-build script which automates the generation of a livepatch module from a source .patch file by performing t
livepatch/klp-build: Introduce klp-build script for generating livepatch modules
Add a klp-build script which automates the generation of a livepatch module from a source .patch file by performing the following steps:
- Builds an original kernel with -function-sections and -fdata-sections, plus objtool function checksumming.
- Applies the .patch file and rebuilds the kernel using the same options.
- Runs 'objtool klp diff' to detect changed functions and generate intermediate binary diff objects.
- Builds a kernel module which links the diff objects with some livepatch module init code (scripts/livepatch/init.c).
- Finalizes the livepatch module (aka work around linker wreckage) using 'objtool klp post-link'.
Acked-by: Petr Mladek <pmladek@suse.com> Tested-by: Joe Lawrence <joe.lawrence@redhat.com> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| 59adee07 | 17-Sep-2025 |
Josh Poimboeuf <jpoimboe@kernel.org> |
livepatch/klp-build: Add stub init code for livepatch modules
Add a module initialization stub which can be linked with binary diff objects to produce a livepatch module.
Acked-by: Petr Mladek <pml
livepatch/klp-build: Add stub init code for livepatch modules
Add a module initialization stub which can be linked with binary diff objects to produce a livepatch module.
Acked-by: Petr Mladek <pmladek@suse.com> Tested-by: Joe Lawrence <joe.lawrence@redhat.com> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|