Blame SOURCES/0504-Try-BOOT_IMAGE-and-fallback-to-vmlinuz-KERNEL.patch

18971c
From 744afe75315b975a7eb431d0a52f6056353bf8f1 Mon Sep 17 00:00:00 2001
18971c
From: Harald Hoyer <harald@redhat.com>
18971c
Date: Thu, 29 Jun 2017 10:38:09 +0200
18971c
Subject: [PATCH] Try BOOT_IMAGE and fallback to vmlinuz-${KERNEL}
18971c
18971c
On s390 BOOT_IMAGE only denotes the number of the boot record that
18971c
was selected in the bootloader and not the path to the kernel image.
18971c
18971c
Also only bail out, if the kernel hmac checking relies on that path.
18971c
18971c
Cherry-picked from: 3d875f77f3d1c5e4161794ca59025bc6bcd77eaa
18971c
Resolves: #1415032
18971c
---
18971c
 modules.d/01fips/fips.sh | 13 +++++++------
18971c
 1 file changed, 7 insertions(+), 6 deletions(-)
18971c
18971c
diff --git a/modules.d/01fips/fips.sh b/modules.d/01fips/fips.sh
18971c
index e9ed00b5..ecd711c2 100755
18971c
--- a/modules.d/01fips/fips.sh
18971c
+++ b/modules.d/01fips/fips.sh
18971c
@@ -79,12 +79,6 @@ do_fips()
18971c
     local _module
18971c
 
18971c
     KERNEL=$(uname -r)
18971c
-    BOOT_IMAGE="$(getarg BOOT_IMAGE)"
18971c
-    BOOT_IMAGE="${BOOT_IMAGE:-/vmlinuz-${KERNEL}}"
18971c
-    if ! [ -e "/boot/.${BOOT_IMAGE}.hmac" ] && ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
18971c
-        warn "/boot/.${BOOT_IMAGE}.hmac does not exist"
18971c
-        return 1
18971c
-    fi
18971c
 
18971c
     FIPSMODULES=$(cat /etc/fipsmodules)
18971c
 
18971c
@@ -117,6 +111,13 @@ do_fips()
18971c
     elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
18971c
         do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
18971c
     else
18971c
+        BOOT_IMAGE="$(getarg BOOT_IMAGE)"
18971c
+        [ -e "/boot/.${BOOT_IMAGE}.hmac" ] || BOOT_IMAGE="vmlinuz-${KERNEL}"
18971c
+
18971c
+        if ! [ -e "/boot/.${BOOT_IMAGE}.hmac" ]; then
18971c
+            warn "/boot/.${BOOT_IMAGE}.hmac does not exist"
18971c
+            return 1
18971c
+        fi
18971c
         sha512hmac -c "/boot/.${BOOT_IMAGE}.hmac" || return 1
18971c
     fi
18971c