render / rpms / edk2

Forked from rpms/edk2 5 months ago
Clone

Blame SOURCES/edk2-MdeModulePkg-PartitionDxe-Ignore-PMBR-BootIndicator-.patch

12bdf0
From 9596c779a27b4ae2261aadd91b8dac8ed7546f38 Mon Sep 17 00:00:00 2001
12bdf0
From: Neal Gompa <ngompa@fedoraproject.org>
12bdf0
Date: Mon, 5 Jul 2021 05:36:03 -0400
12bdf0
Subject: [PATCH] MdeModulePkg/PartitionDxe: Ignore PMBR BootIndicator per UEFI
12bdf0
 spec
12bdf0
MIME-Version: 1.0
12bdf0
Content-Type: text/plain; charset=UTF-8
12bdf0
Content-Transfer-Encoding: 8bit
12bdf0
12bdf0
RH-Author: Philippe Mathieu-Daudé <philmd@redhat.com>
12bdf0
RH-MergeRequest: 6: MdeModulePkg/PartitionDxe: Ignore PMBR BootIndicator per UEFI spec [rhel-8.5.0, post-rebase]
12bdf0
RH-Commit: [1/1] 1fef74489947c81e26e5afb7c933c80beb641751
12bdf0
RH-Bugzilla: 1988762
12bdf0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
12bdf0
12bdf0
Per UEFI Spec 2.8 (UEFI_Spec_2_8_final.pdf, page 114)
12bdf0
5.2.3 Protective MBR
12bdf0
Table 20. Protective MBR Partition Record protecting the entire disk
12bdf0
12bdf0
The description for BootIndicator states the following:
12bdf0
12bdf0
> Set to 0x00 to indicate a non-bootable partition. If set to any
12bdf0
> value other than 0x00 the behavior of this flag on non-UEFI
12bdf0
> systems is undefined. Must be ignored by UEFI implementations.
12bdf0
12bdf0
Unfortunately, we have been incorrectly assuming that the
12bdf0
BootIndicator value must be 0x00, which leads to problems
12bdf0
when the 'pmbr_boot' flag is set on a disk containing a GPT
12bdf0
(such as with GNU parted). When the flag is set, the value
12bdf0
changes to 0x01, causing this check to fail and the system
12bdf0
is rendered unbootable despite it being valid from the
12bdf0
perspective of the UEFI spec.
12bdf0
12bdf0
To resolve this, we drop the check for the BootIndicator
12bdf0
so that we stop caring about the value set there, which
12bdf0
restores the capability to boot such disks.
12bdf0
12bdf0
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3474
12bdf0
12bdf0
Cc: Chris Murphy <chrismurphy@fedoraproject.org>
12bdf0
Cc: David Duncan <davdunc@amazon.com>
12bdf0
Cc: Lazlo Ersek <lersek@redhat.com>
12bdf0
Cc: Hao A Wu <hao.a.wu@intel.com>
12bdf0
Cc: Ray Ni <ray.ni@intel.com>
12bdf0
Cc: Zhichao Gao <zhichao.gao@intel.com>
12bdf0
12bdf0
Signed-off-by: Neal Gompa <ngompa@fedoraproject.org>
12bdf0
Message-Id: <20210705093603.575707-1-ngompa@fedoraproject.org>
12bdf0
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
12bdf0
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
12bdf0
(cherry picked from commit b3db0cb1f8d163f22b769c205c6347376a315dcd)
12bdf0
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
12bdf0
---
12bdf0
 MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c | 3 +--
12bdf0
 1 file changed, 1 insertion(+), 2 deletions(-)
12bdf0
12bdf0
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
12bdf0
index aefb2d6ecb..efaff5e080 100644
12bdf0
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
12bdf0
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
12bdf0
@@ -264,8 +264,7 @@ PartitionInstallGptChildHandles (
12bdf0
   // Verify that the Protective MBR is valid
12bdf0
   //
12bdf0
   for (Index = 0; Index < MAX_MBR_PARTITIONS; Index++) {
12bdf0
-    if (ProtectiveMbr->Partition[Index].BootIndicator == 0x00 &&
12bdf0
-        ProtectiveMbr->Partition[Index].OSIndicator == PMBR_GPT_PARTITION &&
12bdf0
+    if (ProtectiveMbr->Partition[Index].OSIndicator == PMBR_GPT_PARTITION &&
12bdf0
         UNPACK_UINT32 (ProtectiveMbr->Partition[Index].StartingLBA) == 1
12bdf0
         ) {
12bdf0
       break;
12bdf0
-- 
12bdf0
2.27.0
12bdf0