From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web11.8958.1597209812322154103 for ; Tue, 11 Aug 2020 22:23:32 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: ray.ni@intel.com) IronPort-SDR: fHEscFyYMpVN2IU561e73H3E57mNqW1kcqGemyw1HzevXN4Z1OjB1wc36YSvVpIEparnTUL8yI SAPvjrBJ3o8A== X-IronPort-AV: E=McAfee;i="6000,8403,9710"; a="155016529" X-IronPort-AV: E=Sophos;i="5.76,303,1592895600"; d="scan'208";a="155016529" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2020 22:23:31 -0700 IronPort-SDR: CL0fo2QtsmGjWqFHTK+NId22isuKUMCeNeCmtz5j8vNndDZeZK/YVdUtx34B72Za9RhXcnvAti ouGkM4vMQhVg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,303,1592895600"; d="scan'208";a="494913256" Received: from fmsmsx602-2.cps.intel.com (HELO fmsmsx602.amr.corp.intel.com) ([10.18.84.212]) by fmsmga006.fm.intel.com with ESMTP; 11 Aug 2020 22:23:30 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 11 Aug 2020 22:23:30 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 11 Aug 2020 22:23:30 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 11 Aug 2020 22:23:29 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.70]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.222]) with mapi id 14.03.0439.000; Wed, 12 Aug 2020 13:23:26 +0800 From: "Ni, Ray" To: "devel@edk2.groups.io" , "Gao, Zhichao" CC: "Wang, Jian J" , "Wu, Hao A" , Gary Lin , Andrew Fish Subject: Re: [edk2-devel] [PATCH V2 2/3] MdeModulePkg/PartitionDxe: Revert changes for the special MBR Thread-Topic: [edk2-devel] [PATCH V2 2/3] MdeModulePkg/PartitionDxe: Revert changes for the special MBR Thread-Index: AQHWcEbt5kBSqQ8sRk+VwWY/X6awKakz8IWQ Date: Wed, 12 Aug 2020 05:23:24 +0000 Deferred-Delivery: Wed, 12 Aug 2020 05:23:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C66BA55@SHSMSX104.ccr.corp.intel.com> References: <20200812012124.18220-1-zhichao.gao@intel.com> <20200812012124.18220-3-zhichao.gao@intel.com> In-Reply-To: <20200812012124.18220-3-zhichao.gao@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.5.1.3 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Gao, Zhic= hao > Sent: Wednesday, August 12, 2020 9:21 AM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Wu, Hao A = ; Ni, Ray ; Gary Lin > ; Andrew Fish > Subject: [edk2-devel] [PATCH V2 2/3] MdeModulePkg/PartitionDxe: Revert c= hanges for the special MBR >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2823 >=20 > Revert "MdeModulePkg/PartitionDxe: Skip the MBR that add for CD-ROM" >=20 > Follow the spec definition, the ISO 9660 (and UDF) would be > checked before the MBR. So it is not required to skip such > MBR talbe that contian the entire block device. >=20 > Cc: Jian J Wang > Cc: Hao A Wu > Cc: Ray Ni > Cc: Gary Lin > Cc: Andrew Fish > Signed-off-by: Zhichao Gao > --- > .../Universal/Disk/PartitionDxe/Mbr.c | 37 +++---------------- > 1 file changed, 6 insertions(+), 31 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c b/MdeModuleP= kg/Universal/Disk/PartitionDxe/Mbr.c > index 3830af1ea7..f0c92aa09a 100644 > --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c > +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c > @@ -39,7 +39,6 @@ PartitionValidMbr ( > UINT32 StartingLBA; > UINT32 EndingLBA; > UINT32 NewEndingLBA; > - UINT32 SizeInLBA; > INTN Index1; > INTN Index2; > BOOLEAN MbrValid; > @@ -52,34 +51,13 @@ PartitionValidMbr ( > // > MbrValid =3D FALSE; > for (Index1 =3D 0; Index1 < MAX_MBR_PARTITIONS; Index1++) { > - StartingLBA =3D UNPACK_UINT32 (Mbr->Partition[Index1].StartingLBA); > - SizeInLBA =3D UNPACK_UINT32 (Mbr->Partition[Index1].SizeInLBA); > - > - // > - // If the MBR with partition entry covering the ENTIRE disk, i.e. s= tart at LBA0 > - // with whole disk size, we treat it as an invalid MBR partition. > - // > - if ((StartingLBA =3D=3D 0) && > - (SizeInLBA =3D=3D (LastLba + 1))) { > - // > - // Refer to the http://manpages.ubuntu.com/manpages/bionic/man8/m= kudffs.8.html > - // "WHOLE DISK VS PARTITION" > - // Some linux ISOs may put the MBR table in the first 512 bytes f= or compatibility reasons with Windows. > - // Linux kernel ignores MBR table if contains partition which s= tarts at sector 0. > - // Skip it because we don't have the partition check for UDF(El T= orito compatible). > - // It would continue to do the whole disk check in the UDF routin= e. > - // > - DEBUG ((DEBUG_INFO, "PartitionValidMbr: MBR table has partition e= ntry covering the ENTIRE disk. Don't treat it as a > valid MBR.\n")); > - > - return FALSE; > - } > - > - if (Mbr->Partition[Index1].OSIndicator =3D=3D 0x00 || SizeInLBA =3D= = =3D 0) { > + if (Mbr->Partition[Index1].OSIndicator =3D=3D 0x00 || UNPACK_UINT32= (Mbr->Partition[Index1].SizeInLBA) =3D=3D 0) { > continue; > } >=20 > MbrValid =3D TRUE; > - EndingLBA =3D StartingLBA + SizeInLBA - 1; > + StartingLBA =3D UNPACK_UINT32 (Mbr->Partition[Index1].StartingLBA); > + EndingLBA =3D StartingLBA + UNPACK_UINT32 (Mbr->Partition[Index1]= .SizeInLBA) - 1; > if (EndingLBA > LastLba) { > // > // Compatibility Errata: > @@ -99,15 +77,12 @@ PartitionValidMbr ( > } >=20 > for (Index2 =3D Index1 + 1; Index2 < MAX_MBR_PARTITIONS; Index2++) = { > - StartingLBA =3D UNPACK_UINT32 (Mbr->Partition[Index2].StartingLBA= ); > - SizeInLBA =3D UNPACK_UINT32 (Mbr->Partition[Index2].SizeInLBA); > - > - if (Mbr->Partition[Index2].OSIndicator =3D=3D 0x00 || SizeInLBA = =3D=3D 0) { > + if (Mbr->Partition[Index2].OSIndicator =3D=3D 0x00 || UNPACK_UINT= 32 (Mbr->Partition[Index2].SizeInLBA) =3D=3D 0) { > continue; > } >=20 > - NewEndingLBA =3D StartingLBA + SizeInLBA - 1; > - if (NewEndingLBA >=3D StartingLBA && StartingLBA <=3D EndingLBA) = { > + NewEndingLBA =3D UNPACK_UINT32 (Mbr->Partition[Index2].StartingLB= A) + UNPACK_UINT32 (Mbr- > >Partition[Index2].SizeInLBA) - 1; > + if (NewEndingLBA >=3D StartingLBA && UNPACK_UINT32 (Mbr->Partitio= n[Index2].StartingLBA) <=3D EndingLBA) { > // > // This region overlaps with the Index1'th region > // > -- > 2.21.0.windows.1 >=20 >=20 >=20