From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) by mx.groups.io with SMTP id smtpd.web12.8705.1625477796200397086 for ; Mon, 05 Jul 2021 02:36:36 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: gmail.com, ip: 209.85.222.176, mailfrom: ngompa13@gmail.com) Received: by mail-qk1-f176.google.com with SMTP id a4so8489205qkn.11 for ; Mon, 05 Jul 2021 02:36:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ME4JGpxBu95hYNWx3122BqtZD7H03KoJlBdVQo6XIVQ=; b=AmTWqQZGfK53/+3IvN39vva5CtAYEsrsewBLdpxWWQmBflXwccGtk/dhlc1ut/1Xl3 4+KLywpexhX+iNXOAjwjnj+RzZk8Iz79I+O8TIWlAGK6QLSRLsGz2r/uhgaVhIn8gwYt Z3TVp9IWzC7ttrm1xcKL7XoaillK8m7Fr9B8IXiNPYCFN+VDBjkI0C8/QtyhSLe0fqTi lenKjyjLL4QM00To0MmBgTmjN0iofJnHqj13vGpRRPCZxEXuyoXy+rsG8IvewONDaSUt sH1mjQ3mG+Kkl9sgYsZmOYuIO0oUuCsBWr4CvU9TY68wdp5UhI8gVVbgWrhK4su3NJsL qtQA== X-Gm-Message-State: AOAM530kQjZL0Qt+27MGiw3BzKkdjiXXLwoGRy+qqyd44QyUtwBqoucP NO7AKhHJKnXFNwRAVyQ8X88EQtyOQWZ0huLa X-Google-Smtp-Source: ABdhPJzYyic9+VBN1qraHaZQ0JMI5gokadK9GQxKyl09N1flmTRq9cE4Bi7RjAbDoi8OV6h8budTVg== X-Received: by 2002:a37:9986:: with SMTP id b128mr13430056qke.485.1625477795198; Mon, 05 Jul 2021 02:36:35 -0700 (PDT) Return-Path: Received: from Belldandy-Slimbook.datto.net (ool-18e49371.dyn.optonline.net. [24.228.147.113]) by smtp.gmail.com with ESMTPSA id c22sm3278906qtd.42.2021.07.05.02.36.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 02:36:34 -0700 (PDT) From: "Neal Gompa" To: devel@edk2.groups.io Cc: Neal Gompa , Chris Murphy , David Duncan , Lazlo Ersek , Hao A Wu , Ray Ni , Zhichao Gao Subject: [PATCH] MdeModulePkg/PartitionDxe: Ignore PMBR BootIndicator per UEFI spec Date: Mon, 5 Jul 2021 05:36:03 -0400 Message-Id: <20210705093603.575707-1-ngompa@fedoraproject.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Per UEFI Spec 2.8 (UEFI_Spec_2_8_final.pdf, page 114) 5.2.3 Protective MBR Table 20. Protective MBR Partition Record protecting the entire disk The description for BootIndicator states the following: > Set to 0x00 to indicate a non-bootable partition. If set to any > value other than 0x00 the behavior of this flag on non-UEFI > systems is undefined. Must be ignored by UEFI implementations. Unfortunately, we have been incorrectly assuming that the BootIndicator value must be 0x00, which leads to problems when the 'pmbr_boot' flag is set on a disk containing a GPT (such as with GNU parted). When the flag is set, the value changes to 0x01, causing this check to fail and the system is rendered unbootable despite it being valid from the perspective of the UEFI spec. To resolve this, we drop the check for the BootIndicator so that we stop caring about the value set there, which restores the capability to boot such disks. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3474 Cc: Chris Murphy Cc: David Duncan Cc: Lazlo Ersek Cc: Hao A Wu Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Neal Gompa --- MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c b/MdeModulePkg/= Universal/Disk/PartitionDxe/Gpt.c index aefb2d6ecb3f..efaff5e0808f 100644 --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c @@ -264,8 +264,7 @@ PartitionInstallGptChildHandles ( // Verify that the Protective MBR is valid=0D //=0D for (Index =3D 0; Index < MAX_MBR_PARTITIONS; Index++) {=0D - if (ProtectiveMbr->Partition[Index].BootIndicator =3D=3D 0x00 &&=0D - ProtectiveMbr->Partition[Index].OSIndicator =3D=3D PMBR_GPT_PARTIT= ION &&=0D + if (ProtectiveMbr->Partition[Index].OSIndicator =3D=3D PMBR_GPT_PARTIT= ION &&=0D UNPACK_UINT32 (ProtectiveMbr->Partition[Index].StartingLBA) =3D=3D= 1=0D ) {=0D break;=0D --=20 2.31.1