| #
225d16dd |
| 17-Apr-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
klp-build: Validate short-circuit prerequisites
The --short-circuit option implicitly requires that certain directories are already in klp-tmp. Enforce that to prevent confusing errors.
Acked-by:
klp-build: Validate short-circuit prerequisites
The --short-circuit option implicitly requires that certain directories are already in klp-tmp. Enforce that to prevent confusing errors.
Acked-by: Song Liu <song@kernel.org> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
3b8e56b8 |
| 03-Apr-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool/klp: Remove "objtool --checksum"
The checksum functionality has been moved to "objtool klp checksum" which is now used by klp-build. Remove the now-dead --checksum and --debug-checksum opti
objtool/klp: Remove "objtool --checksum"
The checksum functionality has been moved to "objtool klp checksum" which is now used by klp-build. Remove the now-dead --checksum and --debug-checksum options from the default objtool command.
Acked-by: Song Liu <song@kernel.org> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
d4888d58 |
| 03-Apr-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
klp-build: Use "objtool klp checksum" subcommand
Use the new "objtool klp checksum" subcommand instead of injecting --checksum into every objtool invocation via OBJTOOL_ARGS during the kernel build.
klp-build: Use "objtool klp checksum" subcommand
Use the new "objtool klp checksum" subcommand instead of injecting --checksum into every objtool invocation via OBJTOOL_ARGS during the kernel build.
This decouples checksum generation from the build, running it in separate post-build passes, making the code (and the patch generation pipeline itself) more modular.
Acked-by: Song Liu <song@kernel.org> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
b6480aae |
| 30-Apr-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
klp-build: Remove redundant SRC and OBJ variables
SRC and OBJ are both set to $(pwd) and are always identical. The script already enforces that klp-build runs from the kernel root directory, and bu
klp-build: Remove redundant SRC and OBJ variables
SRC and OBJ are both set to $(pwd) and are always identical. The script already enforces that klp-build runs from the kernel root directory, and builds are done in-place, making these variables unnecessary.
Suggested-by: Song Liu <song@kernel.org> Acked-by: Song Liu <song@kernel.org> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
e950d2a1 |
| 04-Apr-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
klp-build: Print "objtool klp diff" command in verbose mode
Print the full objtool command line when '--verbose' is given to help with debugging.
Acked-by: Song Liu <song@kernel.org> Signed-off-by:
klp-build: Print "objtool klp diff" command in verbose mode
Print the full objtool command line when '--verbose' is given to help with debugging.
Acked-by: Song Liu <song@kernel.org> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
df0d7bb0 |
| 20-Apr-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
klp-build: Reject patches to realmode
Realmode code is compiled as a separate 16-bit binary and embedded into the kernel image via rmpiggy.S. It can't be livepatched.
Acked-by: Song Liu <song@kern
klp-build: Reject patches to realmode
Realmode code is compiled as a separate 16-bit binary and embedded into the kernel image via rmpiggy.S. It can't be livepatched.
Acked-by: Song Liu <song@kernel.org> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
d8c3e262 |
| 12-Apr-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
klp-build: Reject patches to vDSO
vDSO code runs in userspace and can't be livepatched. Such patches also cause spurious "new function" errors due to generated files like vdso*-image.c having unsta
klp-build: Reject patches to vDSO
vDSO code runs in userspace and can't be livepatched. Such patches also cause spurious "new function" errors due to generated files like vdso*-image.c having unstable line numbers across builds.
Acked-by: Song Liu <song@kernel.org> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
f3048888 |
| 03-Apr-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
klp-build: Fix patch cleanup on interrupt
If a build error occurs and the user hits Ctrl-C while a large patch is being reverted during cleanup, the cleanup EXIT trap gets re-triggered and tries to
klp-build: Fix patch cleanup on interrupt
If a build error occurs and the user hits Ctrl-C while a large patch is being reverted during cleanup, the cleanup EXIT trap gets re-triggered and tries to re-revert the already partially-reverted patch. That causes 'patch -R' to repeatedly prompt
"Unreversed patch detected! Ignore -R? [n]"
for each already-reverted hunk, with no way to break out.
Fix it by adding '--force' to the patch revert command in revert_patch(), which causes it to silently ignore already-reverted hunks. And ignore errors, as the cleanup is always best-effort.
For similar reasons, add to APPLIED_PATCHES before (rather than after) applying the patch in apply_patch() so an interrupted apply will also get cleaned up.
Fixes: d36a7343f4ba ("livepatch/klp-build: switch to GNU patch and recountdiff") Acked-by: Song Liu <song@kernel.org> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
96524543 |
| 04-Apr-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
klp-build: Suppress excessive fuzz output by default
When a patch applies with fuzz, the detailed output from the patch tool can be very noisy, especially for big patches.
Suppress the fuzz details
klp-build: Suppress excessive fuzz output by default
When a patch applies with fuzz, the detailed output from the patch tool can be very noisy, especially for big patches.
Suppress the fuzz details by default, while keeping the "applied with fuzz" warning. The noise can be restored with '--verbose'.
Acked-by: Song Liu <song@kernel.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
b3ece301 |
| 03-Apr-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
klp-build: Validate patch file existence
Make sure all patch files actually exist. Otherwise there can be confusing errors later.
Acked-by: Song Liu <song@kernel.org> Reviewed-by: Miroslav Benes <
klp-build: Validate patch file existence
Make sure all patch files actually exist. Otherwise there can be confusing errors later.
Acked-by: Song Liu <song@kernel.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
946d3510 |
| 06-Apr-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
klp-build: Don't use errexit
The errtrace option (combined with the ERR trap) already serves the same function (and more) as errexit, so errexit is redundant. And it has more pitfalls. Remove it.
klp-build: Don't use errexit
The errtrace option (combined with the ERR trap) already serves the same function (and more) as errexit, so errexit is redundant. And it has more pitfalls. Remove it.
Acked-by: Song Liu <song@kernel.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
ba77fe55 |
| 11-Apr-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
klp-build: Fix checksum comparison for changed offsets
The klp-build -f/--show-first-changed feature uses diff to compare checksum log lines between original and patched objects. However, diff comp
klp-build: Fix checksum comparison for changed offsets
The klp-build -f/--show-first-changed feature uses diff to compare checksum log lines between original and patched objects. However, diff compares entire lines, including the offset field. When a function is at a different section offset, the offset field differs even though the instruction checksum is identical, causing the wrong instruction to be printed.
Only compare the checksum field when looking for the first changed instruction. Also print both the original and patched offsets when they differ.
Fixes: 78be9facfb5e ("livepatch/klp-build: Add --show-first-changed option to show function divergence") Acked-by: Song Liu <song@kernel.org> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
cc39ccce |
| 03-Apr-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
klp-build: Fix hang on out-of-date .config
If .config is out of date with the kernel source, 'make syncconfig' hangs while waiting for user input on new config options. Detect the mismatch and retu
klp-build: Fix hang on out-of-date .config
If .config is out of date with the kernel source, 'make syncconfig' hangs while waiting for user input on new config options. Detect the mismatch and return an error.
Fixes: 6f93f7b06810 ("livepatch/klp-build: Fix inconsistent kernel version") Acked-by: Song Liu <song@kernel.org> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
4b2bdc22 |
| 14-Apr-2026 |
Linus Torvalds <torvalds@linux-foundation.org> |
Merge tag 'objtool-core-2026-04-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull objtool updates from Ingo Molnar:
- KLP support updates and fixes (Song Liu)
- KLP-build script
Merge tag 'objtool-core-2026-04-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull objtool updates from Ingo Molnar:
- KLP support updates and fixes (Song Liu)
- KLP-build script updates and fixes (Joe Lawrence)
- Support Clang RAX DRAP sequence, to address clang false positive (Josh Poimboeuf)
- Reorder ORC register numbering to match regular x86 register numbering (Josh Poimboeuf)
- Misc cleanups (Wentong Tian, Song Liu)
* tag 'objtool-core-2026-04-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: objtool/x86: Reorder ORC register numbering objtool: Support Clang RAX DRAP sequence livepatch/klp-build: report patch validation fuzz livepatch/klp-build: add terminal color output livepatch/klp-build: provide friendlier error messages livepatch/klp-build: improve short-circuit validation livepatch/klp-build: fix shellcheck complaints livepatch/klp-build: add Makefile with check target livepatch/klp-build: add grep-override function livepatch/klp-build: switch to GNU patch and recountdiff livepatch/klp-build: support patches that add/remove files objtool/klp: Correlate locals to globals objtool/klp: Match symbols based on demangled_name for global variables objtool/klp: Remove .llvm suffix in demangle_name() objtool/klp: Also demangle global objects objtool/klp: Use sym->demangled_name for symbol_name hash objtool/klp: Remove trailing '_' in demangle_name() objtool/klp: Remove redundant strcmp() in correlate_symbols() objtool: Use section/symbol type helpers
show more ...
|
| #
51a0b7c4 |
| 10-Mar-2026 |
Joe Lawrence <joe.lawrence@redhat.com> |
livepatch/klp-build: report patch validation fuzz
Capture the output of the patch command to detect when a patch applies with fuzz or line offsets.
If such "fuzz" is detected during the validation
livepatch/klp-build: report patch validation fuzz
Capture the output of the patch command to detect when a patch applies with fuzz or line offsets.
If such "fuzz" is detected during the validation phase, warn the user and display the details. This helps identify input patches that may need refreshing against the target source tree.
Ensure that internal patch operations (such as those in refresh_patch or during the final build phase) can still run quietly.
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> Acked-by: Song Liu <song@kernel.org> Link: https://patch.msgid.link/20260310203751.1479229-13-joe.lawrence@redhat.com Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
1fbc9b85 |
| 10-Mar-2026 |
Joe Lawrence <joe.lawrence@redhat.com> |
livepatch/klp-build: add terminal color output
Improve the readability of klp-build output by implementing a basic color scheme. When the standard output and error are connected to a terminal, high
livepatch/klp-build: add terminal color output
Improve the readability of klp-build output by implementing a basic color scheme. When the standard output and error are connected to a terminal, highlight status messages in bold and warning/error prefixes in yellow/red.
Acked-by: Song Liu <song@kernel.org> Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260310203751.1479229-12-joe.lawrence@redhat.com Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
b41d8b7d |
| 10-Mar-2026 |
Joe Lawrence <joe.lawrence@redhat.com> |
livepatch/klp-build: provide friendlier error messages
Provide more context for common klp-build failure modes. Clarify which user-provided patch is unsupported or failed to apply, and explicitly i
livepatch/klp-build: provide friendlier error messages
Provide more context for common klp-build failure modes. Clarify which user-provided patch is unsupported or failed to apply, and explicitly identify which kernel build (original or patched) failed.
Acked-by: Song Liu <song@kernel.org> Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260310203751.1479229-11-joe.lawrence@redhat.com Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
6f93f7b0 |
| 10-Mar-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
livepatch/klp-build: Fix inconsistent kernel version
If .config hasn't been synced with auto.conf, any recent changes to CONFIG_LOCALVERSION* may not get reflected in the kernel version name.
Use "
livepatch/klp-build: Fix inconsistent kernel version
If .config hasn't been synced with auto.conf, any recent changes to CONFIG_LOCALVERSION* may not get reflected in the kernel version name.
Use "make syncconfig" to force them to sync, and "make -s kernelrelease" to get the version instead of having to construct it manually.
Fixes: 24ebfcd65a87 ("livepatch/klp-build: Introduce klp-build script for generating livepatch modules") Closes: https://lore.kernel.org/20260217160645.3434685-10-joe.lawrence@redhat.com Reported-by: Joe Lawrence <joe.lawrence@redhat.com> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> Acked-by: Song Liu <song@kernel.org> Link: https://patch.msgid.link/20260310203751.1479229-10-joe.lawrence@redhat.com Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
e506ad21 |
| 10-Mar-2026 |
Joe Lawrence <joe.lawrence@redhat.com> |
livepatch/klp-build: improve short-circuit validation
Update SHORT_CIRCUIT behavior to better handle patch validation and argument processing in later klp-build steps.
Perform patch validation for
livepatch/klp-build: improve short-circuit validation
Update SHORT_CIRCUIT behavior to better handle patch validation and argument processing in later klp-build steps.
Perform patch validation for both step 1 (building original kernel) and step 2 (building patched kernel) to ensure patches are verified before any compilation occurs.
Additionally, allow the user to omit input patches when skipping past step 2.
Acked-by: Song Liu <song@kernel.org> Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260310203751.1479229-9-joe.lawrence@redhat.com Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
b4a53519 |
| 10-Mar-2026 |
Joe Lawrence <joe.lawrence@redhat.com> |
livepatch/klp-build: fix shellcheck complaints
Fix or suppress the following shellcheck warnings:
In klp-build line 57: command grep "$@" || true ^--^ SC2317 (in
livepatch/klp-build: fix shellcheck complaints
Fix or suppress the following shellcheck warnings:
In klp-build line 57: command grep "$@" || true ^--^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
Fix the following warning:
In klp-build line 565: local file_dir="$(dirname "$file")" ^------^ SC2034 (warning): file_dir appears unused. Verify use (or export if used externally).
Acked-by: Song Liu <song@kernel.org> Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260310203751.1479229-8-joe.lawrence@redhat.com Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
e4dbf706 |
| 10-Mar-2026 |
Joe Lawrence <joe.lawrence@redhat.com> |
livepatch/klp-build: add grep-override function
Provide a custom grep() function to catch direct usage of the command. Bare grep calls are generally incompatible with pipefail and errexit behavior (
livepatch/klp-build: add grep-override function
Provide a custom grep() function to catch direct usage of the command. Bare grep calls are generally incompatible with pipefail and errexit behavior (where a failed match causes the script to exit).
Developers can still call grep via command grep if that behavior is explicitly desired.
Acked-by: Song Liu <song@kernel.org> Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260310203751.1479229-6-joe.lawrence@redhat.com Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
d36a7343 |
| 10-Mar-2026 |
Joe Lawrence <joe.lawrence@redhat.com> |
livepatch/klp-build: switch to GNU patch and recountdiff
The klp-build script is currently very strict with input patches, requiring them to apply cleanly via `git apply --recount`. This prevents t
livepatch/klp-build: switch to GNU patch and recountdiff
The klp-build script is currently very strict with input patches, requiring them to apply cleanly via `git apply --recount`. This prevents the use of patches with minor contextual fuzz relative to the target kernel sources.
To allow users to reuse a patch across similar kernel streams, switch to using GNU patch and patchutils for intermediate patch manipulation. Update the logic for applying, reverting, and regenerating patches:
- Use 'patch -p1' for better handling of context fuzz. - Use 'recountdiff' to update line counts after FIX_PATCH_LINES. - Drop git_refresh() and related git-specific logic.
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> Acked-by: Song Liu <song@kernel.org> Link: https://patch.msgid.link/20260310203751.1479229-5-joe.lawrence@redhat.com Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
| #
757bd10f |
| 10-Mar-2026 |
Joe Lawrence <joe.lawrence@redhat.com> |
livepatch/klp-build: support patches that add/remove files
The klp-build script prepares a clean patch by populating two temporary directories ('a' and 'b') with source files and diffing the result.
livepatch/klp-build: support patches that add/remove files
The klp-build script prepares a clean patch by populating two temporary directories ('a' and 'b') with source files and diffing the result. However, this process fails when a patch introduces a new source file, as the script attempts to copy files that do not yet exist in the original source tree. Likewise, it fails when a patch removes a source file and the script attempts to copy a file that no longer exists.
Refactor the file-gathering logic to distinguish between original input files and patched output files:
- Split get_patch_files() into get_patch_input_files() and get_patch_output_files() to identify which files exist before and after patch application. - Filter out "/dev/null" from both to handle file creation/deletion. - Update refresh_patch() to only copy existing input files to the 'a' directory and the resulting output files to the 'b' directory.
Acked-by: Song Liu <song@kernel.org> Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260310203751.1479229-4-joe.lawrence@redhat.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 ...
|
| #
78c268f3 |
| 27-Jan-2026 |
Josh Poimboeuf <jpoimboe@kernel.org> |
livepatch/klp-build: Fix klp-build vs CONFIG_MODULE_SRCVERSION_ALL
When building a patch to a single-file kernel module with CONFIG_MODULE_SRCVERSION_ALL enabled, the klp-build module link fails in
livepatch/klp-build: Fix klp-build vs CONFIG_MODULE_SRCVERSION_ALL
When building a patch to a single-file kernel module with CONFIG_MODULE_SRCVERSION_ALL enabled, the klp-build module link fails in modpost:
Diffing objects drivers/md/raid0.o: changed function: raid0_run Building patch module: livepatch-0001-patch-raid0_run.ko drivers/md/raid0.c: No such file or directory ...
The problem here is that klp-build copied drivers/md/.raid0.o.cmd to the module build directory, but it didn't also copy over the input source file listed in the .cmd file:
source_drivers/md/raid0.o := drivers/md/raid0.c
So modpost dies due to the missing .c file which is needed for calculating checksums for CONFIG_MODULE_SRCVERSION_ALL.
Instead of copying the original .cmd file, just create an empty one. Modpost only requires that it exists. The original object's build dependencies are irrelevant for the frankenobjects used by klp-build.
Fixes: 24ebfcd65a87 ("livepatch/klp-build: Introduce klp-build script for generating livepatch modules") Reported-by: Song Liu <song@kernel.org> Tested-by: Song Liu <song@kernel.org> Link: https://patch.msgid.link/c41b6629e02775e4c1015259aa36065b3fe2f0f3.1769471792.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|