[LTP] [PATCH 1/2] ima_kexec.sh: Detect kernel image

Petr Vorel pvorel@suse.cz
Wed Jan 7 17:20:00 CET 2026


Hi all,

...
> +	if [ ! -f "$IMA_KEXEC_IMAGE" ]; then
> +		uname="$(uname -r)"
> +
> +		# x86_64
> +		f="/boot/vmlinuz-$uname"
> +
> +		# ppc64le, s390x
> +		if [ ! -f "$f" ]; then
> +			f="/boot/vmlinux-$uname"
> +		fi
> +
> +		# aarch64
> +		if [ ! -f "$f" ]; then
> +			f="/boot/Image-$uname"
> +		fi
> +
> +		# aarch64 often uses compression
> +		if [ ! -f "$f" ]; then
> +			f="$(ls /boot/Image-$uname.* || true)"
> +		fi
> +
> +		if [ -f "$f" ]; then
> +			IMA_KEXEC_IMAGE="$f"
> +		fi
> +	fi
> +
>  	if [ ! -f "$IMA_KEXEC_IMAGE" ]; then
>  		tst_brk TCONF "kernel image not found, specify path in \$IMA_KEXEC_IMAGE"
>  	fi

I'm sorry for the noise, I found our s390x emulation actually uses
/boot/image-$uname.  I suggest in the end to merge with following diff.

Kind regards,
Petr

+++ testcases/kernel/security/integrity/ima/tests/ima_kexec.sh
@@ -69,18 +69,16 @@ setup()
 	if [ ! -f "$IMA_KEXEC_IMAGE" ]; then
 		uname="$(uname -r)"
 
-		# x86_64
-		f="/boot/vmlinuz-$uname"
-
-		# ppc64le, s390x
-		if [ ! -f "$f" ]; then
-			f="/boot/vmlinux-$uname"
-		fi
-
-		# aarch64
-		if [ ! -f "$f" ]; then
-			f="/boot/Image-$uname"
-		fi
+		for f in \
+			/boot/vmlinuz-$uname \
+			/boot/vmlinux-$uname \
+			/boot/Image-$uname \
+			/boot/image-$uname \
+		; do
+			if [ -f "$f" ]; then
+				break
+			fi
+		done
 
 		# aarch64 often uses compression
 		if [ ! -f "$f" ]; then


More information about the ltp mailing list