From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=ray.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EA76E2194EB7A for ; Tue, 26 Feb 2019 21:51:55 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2019 21:51:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,418,1544515200"; d="scan'208";a="121121411" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga008.jf.intel.com with ESMTP; 26 Feb 2019 21:51:54 -0800 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 26 Feb 2019 21:51:03 -0800 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 26 Feb 2019 21:51:03 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.102]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.162]) with mapi id 14.03.0415.000; Wed, 27 Feb 2019 13:51:01 +0800 From: "Ni, Ray" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Wang, Jian J" , "Zeng, Star" , Laszlo Ersek Thread-Topic: [PATCH v3 1/2] MdeModulePkg/PartitionDxe: Ensure blocksize holds MBR (CVE-2018-12180) Thread-Index: AQHUzdLKqbpPgZ2L0U2jketNlLWP8qXzJPcQ Date: Wed, 27 Feb 2019 05:47:30 +0000 Deferred-Delivery: Wed, 27 Feb 2019 05:51:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C039771@SHSMSX104.ccr.corp.intel.com> References: <20190226125651.14260-1-hao.a.wu@intel.com> <20190226125651.14260-2-hao.a.wu@intel.com> In-Reply-To: <20190226125651.14260-2-hao.a.wu@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v3 1/2] MdeModulePkg/PartitionDxe: Ensure blocksize holds MBR (CVE-2018-12180) X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Feb 2019 05:51:56 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni > -----Original Message----- > From: Wu, Hao A > Sent: Tuesday, February 26, 2019 8:57 PM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A ; Wang, Jian J ; > Ni, Ray ; Zeng, Star ; Laszlo Erse= k > > Subject: [PATCH v3 1/2] MdeModulePkg/PartitionDxe: Ensure blocksize > holds MBR (CVE-2018-12180) >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1134 >=20 > The commit adds checks for detecting GPT and MBR partitions. >=20 > These checks will ensure that the device block size is big enough to hold > an MBR (512 bytes). >=20 > Cc: Jian J Wang > Cc: Ray Ni > Cc: Star Zeng > Cc: Laszlo Ersek > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Hao Wu > --- > MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c | 9 ++++++++- > MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c | 9 ++++++++- > 2 files changed, 16 insertions(+), 2 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c > b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c > index fe87761bde..d679cc208b 100644 > --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c > +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c > @@ -14,7 +14,7 @@ > partition content and validate the GPT table and GPT entry. >=20 > Copyright (c) 2018 Qualcomm Datacenter Technologies, Inc. > -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D > License > which accompanies this distribution. The full text of the license may b= e > found at > @@ -237,6 +237,13 @@ PartitionInstallGptChildHandles ( > GptValidStatus =3D EFI_NOT_FOUND; >=20 > // > + // Ensure the block size can hold the MBR > + // > + if (BlockSize < sizeof (MASTER_BOOT_RECORD)) { > + return EFI_NOT_FOUND; > + } > + > + // > // Allocate a buffer for the Protective MBR > // > ProtectiveMbr =3D AllocatePool (BlockSize); > diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c > b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c > index b1a99ee85b..419f8a17a7 100644 > --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c > +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c > @@ -13,7 +13,7 @@ >=20 > Copyright (c) 2018 Qualcomm Datacenter Technologies, Inc. > Copyright (c) 2014, Hewlett-Packard Development Company, L.P.
> -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D > License > which accompanies this distribution. The full text of the license may b= e > found at > @@ -150,6 +150,13 @@ PartitionInstallMbrChildHandles ( > MediaId =3D BlockIo->Media->MediaId; > LastBlock =3D BlockIo->Media->LastBlock; >=20 > + // > + // Ensure the block size can hold the MBR > + // > + if (BlockSize < sizeof (MASTER_BOOT_RECORD)) { > + return EFI_NOT_FOUND; > + } > + > Mbr =3D AllocatePool (BlockSize); > if (Mbr =3D=3D NULL) { > return Found; > -- > 2.12.0.windows.1