thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
b38b0f
From 4a1515fe8a1343c66ca3a889897568f13eedd7f3 Mon Sep 17 00:00:00 2001
b38b0f
From: Thomas Huth <thuth@redhat.com>
b38b0f
Date: Wed, 8 May 2019 13:37:49 +0100
b38b0f
Subject: [PATCH] s390-bios: Skip bootmap signature entries
b38b0f
b38b0f
RH-Author: Thomas Huth <thuth@redhat.com>
b38b0f
Message-id: <20190508133749.11555-2-thuth@redhat.com>
b38b0f
Patchwork-id: 87209
b38b0f
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH 1/1] s390-bios: Skip bootmap signature entries
b38b0f
Bugzilla: 1683275
b38b0f
RH-Acked-by: David Hildenbrand <david@redhat.com>
b38b0f
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
b38b0f
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
b38b0f
b38b0f
From: "Jason J. Herne" <jjherne@linux.ibm.com>
b38b0f
b38b0f
Newer versions of zipl have the ability to write signature entries to the boot
b38b0f
script for secure boot. We don't yet support secure boot, but we need to skip
b38b0f
over signature entries while reading the boot script in order to maintain our
b38b0f
ability to boot guest operating systems that have a secure bootloader.
b38b0f
b38b0f
Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com>
b38b0f
Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
b38b0f
Message-Id: <1556543381-12671-1-git-send-email-jjherne@linux.ibm.com>
b38b0f
Signed-off-by: Thomas Huth <thuth@redhat.com>
b38b0f
(cherry picked from commit 2497b4a3c08426122d1a89b808c669a734469e5a)
b38b0f
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
b38b0f
---
b38b0f
 pc-bios/s390-ccw/bootmap.c | 19 +++++++++++++++++--
b38b0f
 pc-bios/s390-ccw/bootmap.h | 10 ++++++----
b38b0f
 2 files changed, 23 insertions(+), 6 deletions(-)
b38b0f
b38b0f
diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
b38b0f
index e41e715..ffbf671 100644
b38b0f
--- a/pc-bios/s390-ccw/bootmap.c
b38b0f
+++ b/pc-bios/s390-ccw/bootmap.c
b38b0f
@@ -309,7 +309,14 @@ static void run_eckd_boot_script(block_number_t bmt_block_nr,
b38b0f
     memset(sec, FREE_SPACE_FILLER, sizeof(sec));
b38b0f
     read_block(block_nr, sec, "Cannot read Boot Map Script");
b38b0f
 
b38b0f
-    for (i = 0; bms->entry[i].type == BOOT_SCRIPT_LOAD; i++) {
b38b0f
+    for (i = 0; bms->entry[i].type == BOOT_SCRIPT_LOAD ||
b38b0f
+                bms->entry[i].type == BOOT_SCRIPT_SIGNATURE; i++) {
b38b0f
+
b38b0f
+        /* We don't support secure boot yet, so we skip signature entries */
b38b0f
+        if (bms->entry[i].type == BOOT_SCRIPT_SIGNATURE) {
b38b0f
+            continue;
b38b0f
+        }
b38b0f
+
b38b0f
         address = bms->entry[i].address.load_address;
b38b0f
         block_nr = eckd_block_num(&bms->entry[i].blkptr.xeckd.bptr.chs);
b38b0f
 
b38b0f
@@ -544,7 +551,15 @@ static void zipl_run(ScsiBlockPtr *pte)
b38b0f
 
b38b0f
     /* Load image(s) into RAM */
b38b0f
     entry = (ComponentEntry *)(&header[1]);
b38b0f
-    while (entry->component_type == ZIPL_COMP_ENTRY_LOAD) {
b38b0f
+    while (entry->component_type == ZIPL_COMP_ENTRY_LOAD ||
b38b0f
+           entry->component_type == ZIPL_COMP_ENTRY_SIGNATURE) {
b38b0f
+
b38b0f
+        /* We don't support secure boot yet, so we skip signature entries */
b38b0f
+        if (entry->component_type == ZIPL_COMP_ENTRY_SIGNATURE) {
b38b0f
+            entry++;
b38b0f
+            continue;
b38b0f
+        }
b38b0f
+
b38b0f
         zipl_load_segment(entry);
b38b0f
 
b38b0f
         entry++;
b38b0f
diff --git a/pc-bios/s390-ccw/bootmap.h b/pc-bios/s390-ccw/bootmap.h
b38b0f
index 732c111..f1ce423 100644
b38b0f
--- a/pc-bios/s390-ccw/bootmap.h
b38b0f
+++ b/pc-bios/s390-ccw/bootmap.h
b38b0f
@@ -98,8 +98,9 @@ typedef struct ScsiMbr {
b38b0f
 #define ZIPL_COMP_HEADER_IPL    0x00
b38b0f
 #define ZIPL_COMP_HEADER_DUMP   0x01
b38b0f
 
b38b0f
-#define ZIPL_COMP_ENTRY_LOAD    0x02
b38b0f
-#define ZIPL_COMP_ENTRY_EXEC    0x01
b38b0f
+#define ZIPL_COMP_ENTRY_EXEC      0x01
b38b0f
+#define ZIPL_COMP_ENTRY_LOAD      0x02
b38b0f
+#define ZIPL_COMP_ENTRY_SIGNATURE 0x03
b38b0f
 
b38b0f
 typedef struct XEckdMbr {
b38b0f
     uint8_t magic[4];   /* == "xIPL"        */
b38b0f
@@ -117,8 +118,9 @@ typedef struct BootMapScriptEntry {
b38b0f
     BootMapPointer blkptr;
b38b0f
     uint8_t pad[7];
b38b0f
     uint8_t type;   /* == BOOT_SCRIPT_* */
b38b0f
-#define BOOT_SCRIPT_EXEC 0x01
b38b0f
-#define BOOT_SCRIPT_LOAD 0x02
b38b0f
+#define BOOT_SCRIPT_EXEC      0x01
b38b0f
+#define BOOT_SCRIPT_LOAD      0x02
b38b0f
+#define BOOT_SCRIPT_SIGNATURE 0x03
b38b0f
     union {
b38b0f
         uint64_t load_address;
b38b0f
         uint64_t load_psw;
b38b0f
-- 
b38b0f
1.8.3.1
b38b0f