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

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