[tip: objtool/core] livepatch/klp-build: provide friendlier error messages

tip-bot2 for Joe Lawrence posted 1 patch 2 weeks, 5 days ago
scripts/livepatch/klp-build |  9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
[tip: objtool/core] livepatch/klp-build: provide friendlier error messages
Posted by tip-bot2 for Joe Lawrence 2 weeks, 5 days ago
The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     b41d8b7d1752f2f85fc1a87f5e4f4dda45adad15
Gitweb:        https://git.kernel.org/tip/b41d8b7d1752f2f85fc1a87f5e4f4dda45adad15
Author:        Joe Lawrence <joe.lawrence@redhat.com>
AuthorDate:    Tue, 10 Mar 2026 16:37:49 -04:00
Committer:     Josh Poimboeuf <jpoimboe@kernel.org>
CommitterDate: Mon, 16 Mar 2026 12:52:53 -07:00

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>
---
 scripts/livepatch/klp-build |  9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
index 60c7635..dc0a23a 100755
--- a/scripts/livepatch/klp-build
+++ b/scripts/livepatch/klp-build
@@ -342,7 +342,7 @@ check_unsupported_patches() {
 		for file in "${files[@]}"; do
 			case "$file" in
 				lib/*|*.S)
-					die "unsupported patch to $file"
+					die "${patch}: unsupported patch to $file"
 					;;
 			esac
 		done
@@ -487,6 +487,7 @@ clean_kernel() {
 }
 
 build_kernel() {
+	local build="$1"
 	local log="$TMP_DIR/build.log"
 	local objtool_args=()
 	local cmd=()
@@ -524,7 +525,7 @@ build_kernel() {
 		"${cmd[@]}"							\
 			1> >(tee -a "$log")					\
 			2> >(tee -a "$log" | grep0 -v "modpost.*undefined!" >&2)
-	)
+	) || die "$build kernel build failed"
 }
 
 find_objects() {
@@ -799,7 +800,7 @@ fi
 if (( SHORT_CIRCUIT <= 1 )); then
 	status "Building original kernel"
 	clean_kernel
-	build_kernel
+	build_kernel "original"
 	status "Copying original object files"
 	copy_orig_objects
 fi
@@ -809,7 +810,7 @@ if (( SHORT_CIRCUIT <= 2 )); then
 	fix_patches
 	apply_patches
 	status "Building patched kernel"
-	build_kernel
+	build_kernel "patched"
 	revert_patches
 	status "Copying patched object files"
 	copy_patched_objects