[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8dbc3602712d9f0481023895c37f9ed7ee44a735.1746821544.git.jpoimboe@kernel.org>
Date: Fri, 9 May 2025 13:17:24 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: x86@...nel.org
Cc: linux-kernel@...r.kernel.org,
Petr Mladek <pmladek@...e.com>,
Miroslav Benes <mbenes@...e.cz>,
Joe Lawrence <joe.lawrence@...hat.com>,
live-patching@...r.kernel.org,
Song Liu <song@...nel.org>,
laokz <laokz@...mail.com>,
Jiri Kosina <jikos@...nel.org>,
Marcos Paulo de Souza <mpdesouza@...e.com>,
Weinan Liu <wnliu@...gle.com>,
Fazla Mehrab <a.mehrab@...edance.com>,
Chen Zhongjin <chenzhongjin@...wei.com>,
Puranjay Mohan <puranjay@...nel.org>
Subject: [PATCH v2 60/62] 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.
Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
---
scripts/livepatch/klp-build | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
index ebbece6f6b8d..08ef903d4090 100755
--- a/scripts/livepatch/klp-build
+++ b/scripts/livepatch/klp-build
@@ -21,7 +21,7 @@ set -o nounset
# This helps keep execution in pipes so pipefail+errexit can catch errors.
shopt -s lastpipe
-unset SKIP_CLEANUP XTRACE
+unset DEBUG_CLONE SKIP_CLEANUP XTRACE
REPLACE=1
SHORT_CIRCUIT=0
shopt -o xtrace | grep -q 'on' && XTRACE=1
@@ -120,6 +120,7 @@ Options:
-v, --verbose Pass V=1 to kernel/module builds
Advanced Options:
+ -D, --debug Show symbol/reloc cloning decisions
-S, --short-circuit=STEP Start at build step (requires prior --keep-tmp)
1|orig Build original kernel (default)
2|patched Build patched kernel
@@ -140,8 +141,8 @@ process_args() {
local long
local args
- short="ho:vS:T"
- long="help,output:,no-replace,verbose,short-circuit:,keep-tmp"
+ short="ho:vDS:T"
+ long="help,output:,no-replace,verbose,debug,short-circuit:,keep-tmp"
args=$(getopt --options "$short" --longoptions "$long" -- "$@") || {
echo; usage; exit
@@ -170,6 +171,11 @@ process_args() {
VERBOSE="V=1"
shift
;;
+ -D | --debug)
+ DEBUG_CLONE=1
+ keep_tmp=1
+ shift
+ ;;
-S | --short-circuit)
[[ ! -d "$TMP_DIR" ]] && die "--short-circuit requires preserved klp-tmp dir"
keep_tmp=1
@@ -559,6 +565,7 @@ copy_patched_objects() {
diff_objects() {
local log="$KLP_DIFF_LOG"
local files=()
+ local opts=()
rm -rf "$DIFF_DIR"
mkdir -p "$DIFF_DIR"
@@ -566,6 +573,8 @@ diff_objects() {
find "$PATCHED_DIR" -type f -name "*.o" | mapfile -t files
[[ ${#files[@]} -eq 0 ]] && die "no changes detected"
+ [[ -v DEBUG_CLONE ]] && opts=("--debug")
+
# Diff all changed objects
for file in "${files[@]}"; do
local rel_file="${file#"$PATCHED_DIR"/}"
@@ -579,6 +588,7 @@ diff_objects() {
cmd=("$SRC/tools/objtool/objtool")
cmd+=("klp")
cmd+=("diff")
+ (( ${#opts[@]} > 0 )) && cmd+=("${opts[@]}")
cmd+=("$orig_file")
cmd+=("$patched_file")
cmd+=("$out_file")
--
2.49.0
Powered by blists - more mailing lists