[tip: objtool/core] livepatch/klp-build: improve short-circuit validation

tip-bot2 for Joe Lawrence posted 1 patch 2 weeks, 5 days ago
scripts/livepatch/klp-build | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
[tip: objtool/core] livepatch/klp-build: improve short-circuit validation
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:     e506ad210d6d7aeaff4bca777428c8c8f9850150
Gitweb:        https://git.kernel.org/tip/e506ad210d6d7aeaff4bca777428c8c8f9850150
Author:        Joe Lawrence <joe.lawrence@redhat.com>
AuthorDate:    Tue, 10 Mar 2026 16:37:47 -04:00
Committer:     Josh Poimboeuf <jpoimboe@kernel.org>
CommitterDate: Mon, 16 Mar 2026 12:46:49 -07:00

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

diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
index 374e126..60c7635 100755
--- a/scripts/livepatch/klp-build
+++ b/scripts/livepatch/klp-build
@@ -220,7 +220,7 @@ process_args() {
 		esac
 	done
 
-	if [[ $# -eq 0 ]]; then
+	if [[ $# -eq 0 ]] && (( SHORT_CIRCUIT <= 2 )); then
 		usage
 		exit 1
 	fi
@@ -791,9 +791,12 @@ build_patch_module() {
 process_args "$@"
 do_init
 
-if (( SHORT_CIRCUIT <= 1 )); then
+if (( SHORT_CIRCUIT <= 2 )); then
 	status "Validating patch(es)"
 	validate_patches
+fi
+
+if (( SHORT_CIRCUIT <= 1 )); then
 	status "Building original kernel"
 	clean_kernel
 	build_kernel