[edk2-devel] [Patch MBR endless loop hang with invalid LBA0 1/1] MdeModulePkg/PartitionDxe: Add break to handle invalid LBA0 in MBR

Wu, Hao A hao.a.wu at intel.com
Thu Jan 6 03:20:57 UTC 2022


Inline comment below:


From: Edwards, Craig <Craig.Edwards at dell.com>
Sent: Thursday, January 6, 2022 2:53 AM
To: Gao, Liming <gaoliming at byosoft.com.cn>; Wang, Jian J <jian.j.wang at intel.com>; Wu, Hao A <hao.a.wu at intel.com>; Ni, Ray <ray.ni at intel.com>; Gao, Zhichao <zhichao.gao at intel.com>; devel at edk2.groups.io; Shutt, Mark <mark.shutt at dell.com>
Subject: [Patch MBR endless loop hang with invalid LBA0 1/1] MdeModulePkg/PartitionDxe: Add break to handle invalid LBA0 in MBR

Read Disk does a modification of ExtMbrStartingLba with the code MultU64x32
(ExtMbrStartingLba, BlockSize) Error detection to see if ExtMbrStartingLBA
has a value of 0. This is invalid as LBA 0 = MBR. After modification, the
next time ExtMbrStartingLba is in this function if ExtMbrStartingLba is set
to 0 in the MBR it never passes the while/do evaluation It is multiplied by 0
by read disk , set to 0 by an invalid MBR and goes back to evaluation This
condition will also cause Ws19 and WS22 to hang, however Microsoft has
developed a hotfix patch that will be released in 2022

Cc: Liming Gao <gaoliming at byosoft.com.cn<mailto:gaoliming at byosoft.com.cn>>
Cc: Jian J Wang <jian.j.wang at intel.com<mailto:jian.j.wang at intel.com>>
Cc: Hao A Wu <hao.a.wu at intel.com<mailto:hao.a.wu at intel.com>>
Cc: Ray Ni <ray.ni at intel.com<mailto:ray.ni at intel.com>>
Cc: Zhichao Gao <zhichao.gao at intel.com<mailto:zhichao.gao at intel.com>>

Signed-off-by: Craig Edwards <craig.edwards at dell.com<mailto:craig.edwards at dell.com>>

Date:      Wed Jan 5 12:27:46 2022 -0600

On branch graceful_handle_mbr_hang_edit1
Changes to be committed:
        modified:   MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
---
MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
index 0f8dc5486521..ad18840e5efd 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
@@ -293,6 +293,12 @@ PartitionInstallMbrChildHandles (
           (Mbr->Partition[0].OSIndicator == EXTENDED_WINDOWS_PARTITION))
       {
         ExtMbrStartingLba = UNPACK_UINT32 (Mbr->Partition[0].StartingLBA);
+          //
+          // A value of 0 is invalid for StartingLBA
+          //
+          if (ExtMbrStartingLba == 0) {
+            break;
+          }


Seems the indent includes 2 unneeded spaces. I will help to remove them when merging the patch.
Reviewed-by: Hao A Wu <hao.a.wu at intel.com>

Will wait a couple of days before merging to see if comments from other reviewers.

Best Regards,
Hao Wu


         continue;
       }

--
2.32.0.windows.1





Craig Edwards
Software Engineer
Dell | GDP | PSE | COMMS | BIOS
Craig_Edwards at Dell.com<mailto:Craig_Edwards at Dell.com%0d>




Internal Use - Confidential



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#85295): https://edk2.groups.io/g/devel/message/85295
Mute This Topic: https://groups.io/mt/88220894/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20220106/ddf0af6c/attachment.htm>


More information about the edk2-devel-archive mailing list