summaryrefslogtreecommitdiff
path: root/scripts/livepatch/klp-build
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-08-18 12:18:33 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-08-18 12:18:33 -0700
commita0acd94e3819fcd8346ae3c16df987e0fabb3128 (patch)
tree42b1fd69eac025cc5883778d63cbe055393b182c /scripts/livepatch/klp-build
parent1200d84f4c0a929a0780180d25063d93773be79c (diff)
parentd8a2860b4a366bfa8acb3d64da2c546ea26d2091 (diff)
Merge tag 'objtool-core-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull objtool updates from Ingo Molnar: - Fix various klp-build bugs reported by Joe Lawrence (Josh Poimboeuf, Joe Lawrence) - Misc fixes and cleanups (Puranjay Mohan, Thomas Huth and Ingo Molnar) * tag 'objtool-core-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: objtool/klp: Fix vmlinux klp relocations for EXPORT_SYMBOL_FOR_MODULES() objtool/klp: Fix .kcfi_traps special section extraction objtool/klp: Fix vmlinux .klp.symid link error for .exitcall.exit symbols objtool/klp: Fix line numbers in Module.symvers parse errors objtool/klp: Fix relocations for EXPORT_SYMBOL_FOR_MODULES() symbols objtool/klp: Allow new references to module exports objtool/klp: Don't match local symbols against exports objtool/klp: Fix cross-module klp relocation section naming objtool/klp: Explicitly disallow patching or referencing init code/data objtool/klp: Ignore replacement offset of empty x86 alternatives objtool/klp: Fix size of empty special section entries objtool/klp: Fix vmlinux .klp.symid link error for .no_trim_symbol symbols objtool/headers: Sync tools/include/linux/objtool_types.h with include/linux/objtool_types.h objtool: Replace __ASSEMBLY__ with __ASSEMBLER__ in header files objtool/klp: Fix symbol resolution for duplicate data symbols objtool/klp: Add .klp.symid for sympos disambiguation objtool/klp: Skip hidden directories when finding objects objtool/klp: Fix false module dependencies caused by dead relocs objtool/klp: Normalize Module.symvers paths to module names objtool/klp: Fix module name normalization for paths with dots
Diffstat (limited to 'scripts/livepatch/klp-build')
-rwxr-xr-xscripts/livepatch/klp-build14
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
index c4a7acf8edc3..b52a8489d9f6 100755
--- a/scripts/livepatch/klp-build
+++ b/scripts/livepatch/klp-build
@@ -271,6 +271,9 @@ validate_config() {
[[ -v CONFIG_GCC_PLUGIN_RANDSTRUCT ]] && \
die "kernel option 'CONFIG_GCC_PLUGIN_RANDSTRUCT' not supported"
+ [[ -v CONFIG_LD_DEAD_CODE_DATA_ELIMINATION ]] && \
+ die "kernel option 'CONFIG_LD_DEAD_CODE_DATA_ELIMINATION' not supported"
+
[[ -v CONFIG_AS_IS_LLVM ]] && \
[[ "$CONFIG_AS_VERSION" -lt 200000 ]] && \
die "Clang assembler version < 20 not supported"
@@ -555,6 +558,8 @@ build_kernel() {
#
cmd+=("KBUILD_MODPOST_WARN=1")
+ cmd+=("KLP_SYMIDS=1")
+
if [[ -v VERBOSE ]]; then
cmd+=("V=1")
else
@@ -575,8 +580,9 @@ find_objects() {
local opts=("$@")
# Find root-level vmlinux.o and non-root-level .ko files,
- # excluding klp-tmp/ and .git/
- find "$PWD" \( -path "$TMP_DIR" -o -path "$PWD/.git" -o -regex "$PWD/[^/][^/]*\.ko" \) -prune -o \
+ # excluding klp-tmp/ and hidden directories.
+ find "$PWD" -mindepth 1 \
+ \( -path "$TMP_DIR" -o -name ".*" -o -regex "$PWD/[^/][^/]*\.ko" \) -prune -o \
-type f "${opts[@]}" \
\( -name "*.ko" -o -path "$PWD/vmlinux.o" \) \
-printf '%P\n'
@@ -605,6 +611,8 @@ copy_orig_objects() {
done
xtrace_restore
+ cp -f "$PWD/vmlinux" "$ORIG_DIR" || die "missing vmlinux"
+
mv -f "$TMP_DIR/build.log" "$ORIG_DIR"
touch "$TIMESTAMP"
touch "$ORIG_DIR/.complete"
@@ -675,6 +683,8 @@ generate_checksums() {
"$OBJTOOL" klp checksum "$dest"
done
+ [[ -f "$src_dir/vmlinux" ]] && cp -f "$src_dir/vmlinux" "$dest_dir"
+
touch "$dest_dir/.complete"
}