yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-pc_sysfw-prevent-pflash-and-or-mis-sized-firmware-fo.patch

9ae3a8
From c3f813d2f53fb8f9e2dc7e2b3c6b17d7fadb2de5 Mon Sep 17 00:00:00 2001
9ae3a8
From: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Date: Tue, 27 Jan 2015 17:48:11 +0100
9ae3a8
Subject: [PATCH 08/16] pc_sysfw: prevent pflash and/or mis-sized firmware for
9ae3a8
 rhel6.x.0 machtypes
9ae3a8
9ae3a8
Message-id: <1422380891-11054-3-git-send-email-lersek@redhat.com>
9ae3a8
Patchwork-id: 63585
9ae3a8
O-Subject: [RHEL-7.2 qemu-kvm PATCH 2/2] pc_sysfw: prevent pflash and/or mis-sized firmware for rhel6.x.0 machtypes
9ae3a8
Bugzilla: 1176283
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
9ae3a8
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
9ae3a8
QE tried to boot OVMF on a rhel6.x.0 machine type. The shadow_bios()
9ae3a8
migration hack that is in effect for those machine types is not compatible
9ae3a8
with the OVMF image. An assert() in shadow_bios() catches it, but -- given
9ae3a8
that OVMF has never been intended for rhel6.x.0 machine types -- QE has
9ae3a8
rather requested us to deny such startups cleanly.
9ae3a8
9ae3a8
The first hunk prevents "-M rhel6.x.0 -bios ..." style invocations where
9ae3a8
the BIOS image is not 128 KB in size. This was suggested by Paolo and it
9ae3a8
prevents the case when someone passes an OVMF binary via -bios.
9ae3a8
9ae3a8
The second hunk prevents "-M rhel6.x.0 -pflash ...", since that
9ae3a8
configuration (for boot firmware purposes or otherwise) was never
9ae3a8
supported.
9ae3a8
9ae3a8
Downstream only.
9ae3a8
9ae3a8
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/i386/pc_sysfw.c | 11 +++++++++++
9ae3a8
 1 file changed, 11 insertions(+)
9ae3a8
9ae3a8
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
9ae3a8
index 6f5ecde..2f26ff5 100644
9ae3a8
--- a/hw/i386/pc_sysfw.c
9ae3a8
+++ b/hw/i386/pc_sysfw.c
9ae3a8
@@ -191,6 +191,11 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
9ae3a8
         (bios_size % 65536) != 0) {
9ae3a8
         goto bios_error;
9ae3a8
     }
9ae3a8
+    if (shadow_bios_after_incoming && bios_size != 128 * 1024) {
9ae3a8
+        error_report("machine %s only supports a 128KB BIOS image",
9ae3a8
+                     current_machine->name);
9ae3a8
+        exit(1);
9ae3a8
+    }
9ae3a8
     bios = g_malloc(sizeof(*bios));
9ae3a8
     memory_region_init_ram(bios, "pc.bios", bios_size);
9ae3a8
     vmstate_register_ram_global(bios);
9ae3a8
@@ -241,6 +246,12 @@ void pc_system_firmware_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
9ae3a8
         return;
9ae3a8
     }
9ae3a8
 
9ae3a8
+    if (shadow_bios_after_incoming) {
9ae3a8
+        error_report("flash-based firmware is not supported by machine %s",
9ae3a8
+                     current_machine->name);
9ae3a8
+        exit(1);
9ae3a8
+    }
9ae3a8
+
9ae3a8
     if (kvm_enabled() && !kvm_readonly_mem_enabled()) {
9ae3a8
         /* Older KVM cannot execute from device memory. So, flash memory
9ae3a8
          * cannot be used unless the readonly memory kvm capability is present. */
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8