* [Patch MBR endless loop hang with invalid LBA0 1/1] MdeModulePkg/PartitionDxe: Add break to handle invalid LBA0 in MBR @ 2022-01-05 18:53 Edwards, Craig 2022-01-06 3:20 ` Wu, Hao A 0 siblings, 1 reply; 3+ messages in thread From: Edwards, Craig @ 2022-01-05 18:53 UTC (permalink / raw) To: gaoliming@byosoft.com.cn, jian.j.wang@intel.com, hao.a.wu@intel.com, ray.ni@intel.com, zhichao.gao@intel.com, devel@edk2.groups.io, Shutt, Mark [-- Attachment #1: Type: text/plain, Size: 2175 bytes --] 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@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>> Cc: Jian J Wang <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>> Cc: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>> Cc: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>> Cc: Zhichao Gao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>> Signed-off-by: Craig Edwards <craig.edwards@dell.com<mailto:craig.edwards@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; + } continue; } -- 2.32.0.windows.1 Craig Edwards Software Engineer Dell | GDP | PSE | COMMS | BIOS Craig_Edwards@Dell.com<mailto:Craig_Edwards@Dell.com%0d> Internal Use - Confidential [-- Attachment #2: Type: text/html, Size: 6733 bytes --] ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Patch MBR endless loop hang with invalid LBA0 1/1] MdeModulePkg/PartitionDxe: Add break to handle invalid LBA0 in MBR 2022-01-05 18:53 [Patch MBR endless loop hang with invalid LBA0 1/1] MdeModulePkg/PartitionDxe: Add break to handle invalid LBA0 in MBR Edwards, Craig @ 2022-01-06 3:20 ` Wu, Hao A 2022-01-10 7:18 ` [edk2-devel] " Wu, Hao A 0 siblings, 1 reply; 3+ messages in thread From: Wu, Hao A @ 2022-01-06 3:20 UTC (permalink / raw) To: Edwards, Craig, Gao, Liming, Wang, Jian J, Ni, Ray, Gao, Zhichao, devel@edk2.groups.io, Shutt, Mark [-- Attachment #1: Type: text/plain, Size: 2905 bytes --] Inline comment below: From: Edwards, Craig <Craig.Edwards@dell.com> Sent: Thursday, January 6, 2022 2:53 AM To: Gao, Liming <gaoliming@byosoft.com.cn>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; devel@edk2.groups.io; Shutt, Mark <mark.shutt@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@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>> Cc: Jian J Wang <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>> Cc: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>> Cc: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>> Cc: Zhichao Gao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>> Signed-off-by: Craig Edwards <craig.edwards@dell.com<mailto:craig.edwards@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@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@Dell.com<mailto:Craig_Edwards@Dell.com%0d> Internal Use - Confidential [-- Attachment #2: Type: text/html, Size: 15093 bytes --] ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [Patch MBR endless loop hang with invalid LBA0 1/1] MdeModulePkg/PartitionDxe: Add break to handle invalid LBA0 in MBR 2022-01-06 3:20 ` Wu, Hao A @ 2022-01-10 7:18 ` Wu, Hao A 0 siblings, 0 replies; 3+ messages in thread From: Wu, Hao A @ 2022-01-10 7:18 UTC (permalink / raw) To: devel@edk2.groups.io, Wu, Hao A, Edwards, Craig, Gao, Liming, Wang, Jian J, Ni, Ray, Gao, Zhichao, Shutt, Mark [-- Attachment #1: Type: text/plain, Size: 3859 bytes --] Pushed via: PR - https://github.com/tianocore/edk2/pull/2399 Commit - https://github.com/tianocore/edk2/commit/6062002bd5a394fef46243dd866860c3480d918e Best Regards, Hao Wu From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, Hao A Sent: Thursday, January 6, 2022 11:21 AM To: Edwards, Craig <Craig.Edwards@dell.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Wang, Jian J <jian.j.wang@intel.com>; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; devel@edk2.groups.io; Shutt, Mark <mark.shutt@dell.com> Subject: Re: [edk2-devel] [Patch MBR endless loop hang with invalid LBA0 1/1] MdeModulePkg/PartitionDxe: Add break to handle invalid LBA0 in MBR Inline comment below: From: Edwards, Craig <Craig.Edwards@dell.com<mailto:Craig.Edwards@dell.com>> Sent: Thursday, January 6, 2022 2:53 AM To: Gao, Liming <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>; Wang, Jian J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Gao, Zhichao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Shutt, Mark <mark.shutt@dell.com<mailto:mark.shutt@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@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>> Cc: Jian J Wang <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>> Cc: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>> Cc: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>> Cc: Zhichao Gao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>> Signed-off-by: Craig Edwards <craig.edwards@dell.com<mailto:craig.edwards@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@intel.com<mailto:hao.a.wu@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@Dell.com<mailto:Craig_Edwards@Dell.com%0d> Internal Use - Confidential [-- Attachment #2: Type: text/html, Size: 17119 bytes --] ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-10 7:18 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-01-05 18:53 [Patch MBR endless loop hang with invalid LBA0 1/1] MdeModulePkg/PartitionDxe: Add break to handle invalid LBA0 in MBR Edwards, Craig 2022-01-06 3:20 ` Wu, Hao A 2022-01-10 7:18 ` [edk2-devel] " Wu, Hao A
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox