render / rpms / edk2

Forked from rpms/edk2 3 months ago
Clone

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

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