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

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