From 96d6ca7ae01d537ab972798417b9453d57c03cd7 Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Sun, 8 Jan 2023 07:09:09 -0500 Subject: [PATCH] improve kernel and initrd file detection --- .../security-misc/cold-boot-attack-defense-kexec-prepare | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr/libexec/security-misc/cold-boot-attack-defense-kexec-prepare b/usr/libexec/security-misc/cold-boot-attack-defense-kexec-prepare index 86153cc..344ad19 100755 --- a/usr/libexec/security-misc/cold-boot-attack-defense-kexec-prepare +++ b/usr/libexec/security-misc/cold-boot-attack-defense-kexec-prepare @@ -10,6 +10,11 @@ set -e ## Get the kernel command-line arguments cmdline=$(cat /proc/cmdline) +if [ "$cmdline" = "" ]; then + echo "$0: ERROR: /proc/cmdline is empty!" + exit 1 +fi + boot_image_full=$(echo "$cmdline" | grep -o 'BOOT_IMAGE=\S*') ## example boot_image_full: ## BOOT_IMAGE=/vmlinuz-5.10.0-20-amd64