[LTP] [PATCH 1/1] ima_kexec.sh: Detect kexec --reuse-cmdline support

Petr Vorel pvorel@suse.cz
Thu Sep 4 11:07:39 CEST 2025


For some arch support for --reuse-cmdline was added recently (i.e.
ppc64le in v2.0.27 in Aug 2023), therefore older supported systems does
not have it. Detect the support and skip if not available.

While at it log kexec version.

Reported-by: Martin Doucha <mdoucha@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi all,

a candidate for a release fix.
Tested on various kernel versions and archs.

Kind regards,
Petr

 .../kernel/security/integrity/ima/tests/ima_kexec.sh  | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/testcases/kernel/security/integrity/ima/tests/ima_kexec.sh b/testcases/kernel/security/integrity/ima/tests/ima_kexec.sh
index 9093ba2d64..d6eb0829d8 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_kexec.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_kexec.sh
@@ -68,6 +68,13 @@ setup()
 	fi
 
 	tst_res TINFO "using kernel $IMA_KEXEC_IMAGE"
+
+	tst_res TINFO "$(kexec -v)"
+
+	REUSE_CMDLINE_SUPPORTED=
+	if kexec -h 2>&1 | grep -q reuse-cmdline; then
+		REUSE_CMDLINE_SUPPORTED=1
+	fi
 }
 
 kexec_failure_hint()
@@ -100,6 +107,10 @@ kexec_test()
 
 	kexec_cmd="$param=$cmdline"
 	if [ "$param" = '--reuse-cmdline' ]; then
+		if [ "$REUSE_CMDLINE_SUPPORTED" != 1 ]; then
+			tst_res TCONF "--reuse-cmdline not supported"
+			return
+		fi
 		cmdline="$(sed 's/BOOT_IMAGE=[^ ]* //' /proc/cmdline)"
 		kexec_cmd="$param"
 	fi
-- 
2.50.1



More information about the ltp mailing list