[tip: objtool/core] klp-build: Fix hang on out-of-date .config

tip-bot2 for Josh Poimboeuf posted 1 patch 1 month, 1 week ago
scripts/livepatch/klp-build | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
[tip: objtool/core] klp-build: Fix hang on out-of-date .config
Posted by tip-bot2 for Josh Poimboeuf 1 month, 1 week ago
The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     cc39ccce7d5bc623100f07dcda070cef1bf690f6
Gitweb:        https://git.kernel.org/tip/cc39ccce7d5bc623100f07dcda070cef1bf690f6
Author:        Josh Poimboeuf <jpoimboe@kernel.org>
AuthorDate:    Thu, 02 Apr 2026 19:47:10 -07:00
Committer:     Josh Poimboeuf <jpoimboe@kernel.org>
CommitterDate: Mon, 04 May 2026 21:16:02 -07:00

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

diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
index 0ad7e66..e19d93b 100755
--- a/scripts/livepatch/klp-build
+++ b/scripts/livepatch/klp-build
@@ -306,7 +306,12 @@ set_kernelversion() {
 
 	stash_file "$file"
 
-	kernelrelease="$(cd "$SRC" && make syncconfig &>/dev/null && make -s kernelrelease)"
+	if [[ -n "$(make -s listnewconfig 2>/dev/null)" ]]; then
+		die ".config mismatch, check your .config or run 'make olddefconfig'"
+	fi
+	make syncconfig &>/dev/null || die "make syncconfig failed"
+
+	kernelrelease="$(make -s kernelrelease)"
 	[[ -z "$kernelrelease" ]] && die "failed to get kernel version"
 
 	sed -i "2i echo $kernelrelease; exit 0" scripts/setlocalversion