From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.70630.1679574017581274414 for ; Thu, 23 Mar 2023 05:20:17 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=KWTn8Rbq; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679574017; x=1711110017; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=2GHhQtxDPruqXOWtfCMIAr1vYbH9JVhMHQxK27w+hXE=; b=KWTn8RbqGUcQlFPXavGdrUbpXaIJ0uEm9y1X7h0WptXUoSv9jN3kTFRM mcKADp1cD0zkztu29eMUJjSpi5DbufQWKmwZ6M/IM8Fdscaj051wbqgjl xsw2JWdzGz9LJC7LJs7XWnzo/68ZH2cbmeKG8ZZQYZpX1jMdZXxHrxTG/ RJceWPRZ0AEzYY7W5Djxmt0SEQYlBERN3waGRD9iE4XsXTxO4ebY+tu1d v7hyQGlUfxMuuFLFE5bxAkxFJCNOeiLPpL1bIO5kWM56uueM8gNJYPFpm NLxsyy5W9cIXtmc9E5la3iaE+IB1kSkazar/EVoWglvoYrflbMt1RdgqG A==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="404357103" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="404357103" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 05:20:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675678259" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675678259" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga007.jf.intel.com with ESMTP; 23 Mar 2023 05:20:16 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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.2507.21; Thu, 23 Mar 2023 05:20:15 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Thu, 23 Mar 2023 05:20:15 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.41) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Thu, 23 Mar 2023 05:20:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S7Nz6N6YJmKU11XKAWM6oMJG4bY/zb8OJ0muwMTt5H/leB4yzW3SFo6g7HkMeeHq66TcvrmLSiOhO6t7YTpd/0mGhu46/XWiL4ag2WDF6E38N8AHASV75GpJxdIwvQLHOGYALd1Ny4d7OrizcKJq/RMrikGmnNOahmCUoG2b7Sqvoe1wPOEndK8V5ibBcZaFKGnhcmKuvQ2eYYSEZJ4EICYBYNxb/2qjKZHnGLpe7fvGbfuLwgNO+K/Q+cNXP9vyQvVnCZ75EAEgFGMb6jOtWgKpibSx46GmhwCrLWY63leuAk/So3XdySBPQLmKNfhY9LuGyxNrWoADD6TnEK+W0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AdCj+WHtKmHbKoL2y06ENgAFHs3bc/3x6AC6454MgWk=; b=HuiCM/xtSRUfSYJS/wENHMjdRUizh8oxvNt68wfewI1ZWBqBnlz3C/bLikOMd2Jr86qKPYz+v1spKKhZS06UT3hJPxt4tTTqf2qWh6wqx7VFmnDxSqKYVghSas4eroYom8DdtqDKiyrHve75UWs7kQ3nM59VLIz86Ktf6FC9dNsC6cqJlhA2iJm1b6y5PizK1jC4gWw4oZ9NzXTDUVfRAo63Duv7tIqP6LzjxtxPpDNxaDNp6E4JsJ3k3qWcUluYBlbFfSjXshmJulV+7CCVgvHIOZ3lgLHdOkznDOaJpql4m+r8Fw7h7VM1UE7PsSz8QRYdLswrUrWwuyoeR8j5Ew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by DM4PR11MB6527.namprd11.prod.outlook.com (2603:10b6:8:8e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.38; Thu, 23 Mar 2023 12:20:13 +0000 Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::ae07:e96a:4a24:8a69]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::ae07:e96a:4a24:8a69%7]) with mapi id 15.20.6178.037; Thu, 23 Mar 2023 12:20:13 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" CC: "Dong, Eric" , "Kumar, Rahul R" , Gerd Hoffmann Subject: Re: [Patch V4 02/21] UefiCpuPkg/CpuPageTableLib: Add check for input Length Thread-Topic: [Patch V4 02/21] UefiCpuPkg/CpuPageTableLib: Add check for input Length Thread-Index: AQHZXVracHztJTbkzEy3CvFFuJcBW68ISPdA Date: Thu, 23 Mar 2023 12:20:13 +0000 Message-ID: References: <20230323074057.549-1-dun.tan@intel.com> <20230323074057.549-3-dun.tan@intel.com> In-Reply-To: <20230323074057.549-3-dun.tan@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|DM4PR11MB6527:EE_ x-ms-office365-filtering-correlation-id: 6fefd6e7-a506-40fb-9aa5-08db2b98f40f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2B2PVFETU0Cj/qE5luVHmP4Z2fcGxQqQVzS77ZnbG84RM3W7FM9DIz98BQmibpZ/HZUco/DfqEUNz6lsKc6TiNoS021YWVrY69+vG2oRsTYtiwObC1RM0O2Oo1GsbkZyGZeXdQmsTAdHBW14FqCNggusk2VgkjeBVPlYanaMJgxAc9Hm5qplItGbZNp2wyV5cLMENIRW1GmCUL+6wdZaD/PI3p2Wrn2zLRsu1JM+DR31Afr9PUB4CbzRrEFG83zniUeFM8EI0UMP5w0GRcoVH8oGwKcCeO+YGO1Dg3EJNC7gYGAeF2ETCUGkAprhDinRNbKIsotjCBodrrosWMvQOkIwlDGnMt+53LiU4ky7hc/+65SKyAeULstGxQr4PKhiT3/qvnMMyw0XGv3bjH38DwzbjLWcNMUzYbqBGJyg8irnoHmf7Pm5cEoSThip6ME1VrvzCotKdv3TwS8hH2q6MYxkIdtzTRf5OPBDGcgkwoU7CXQLYXDrvSSJIadi3iyPkj28a8nBpUF0vNc7EK0mF6oGBsUl7AflqnTua/hqLpulODCmLY390Zv+R1a+s1KgEBC8KeDECs+nfC0Xk9D45AIrEC2owHkEQ9v54i6NznzK5bfyf4bVpmVF+lol3R6Jgoey2RjKyfGX2F4s5RC6xIDkvPQfhOa0t8dDwEzJWBkIzUTtgfi1pX7q6+AUm8GRqx4lySnk9j7EJtv0Zjf0Ng== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN6PR11MB8244.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(39860400002)(376002)(346002)(396003)(366004)(136003)(451199018)(4326008)(76116006)(66556008)(66476007)(66446008)(64756008)(8676002)(66946007)(110136005)(316002)(54906003)(5660300002)(122000001)(82960400001)(41300700001)(8936002)(52536014)(53546011)(26005)(6506007)(186003)(9686003)(71200400001)(83380400001)(478600001)(33656002)(86362001)(7696005)(55016003)(38070700005)(38100700002)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?RpJ6UyIPtB4K+b21YYoP5bUPhcqEp4znNzKtb8/k6/vBb4iI/krQAhjDwqft?= =?us-ascii?Q?BkjnV7RTIntI1ml8bRRNPfgPZ7lTllry9sRMHL4JS7B5Oe5OUWCk8wfaYkRm?= =?us-ascii?Q?XI93AhjtL1yXkc4NSU3MJ/qGs5vQDVFF578toHpNYA1Hmoki4AT8duTuvhD2?= =?us-ascii?Q?gZuAtY25H0++2vhX8tbv0tbfj/xzp7kQu33MCKS665hPB5WEvMBznBjPNz1o?= =?us-ascii?Q?82gpVvmyLOGlElm54PGDCgXALhq0SdKgN8ayisRAkEmkArQo50dsZwF0iSyE?= =?us-ascii?Q?MInL8ovoDHqt5/DLwuEq3laC8sNKTfj07yXuEai5PYqVrSZCV6w5GlQF/DPI?= =?us-ascii?Q?MqHtRavSzIBjUksjSGKVfZDJ2VN2mQwpEhRprVCY6+MPVgw4CyT7AKNeGmli?= =?us-ascii?Q?LpFPC6FU3FqR2+9NpHNH3T96nyisd2XsAd+8oOPjvpfAJ6WAku8b9dNebypZ?= =?us-ascii?Q?Sfwp3s8i1V+tqV+TlH3BgzmUuJGtywJzkaswa0fBmNPNhn83tHd1clFzm/sC?= =?us-ascii?Q?95oqFPxZB/yJ20ijoxoRa6v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-ascii?Q?ggbdj0X3Wc/gCIjyvpSzLX+1xJ7IIaA7XIS3BMPgTvxB3M05QEU6QFpeuAKe?= =?us-ascii?Q?lpOBn63pIiEo4MeW+buB2pn6fREtu128dMBDctvQwLugnTUJHyGfN7foa8Ym?= =?us-ascii?Q?LHPynRSWfQCwdptndL8=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6fefd6e7-a506-40fb-9aa5-08db2b98f40f X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Mar 2023 12:20:13.2587 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: jvNdI5iAgCIu3SJ4BOfJoTM4TepXRLiN+oHGHuskic0khjhxgDHsYXMECHCVIeJinkHcNQS+CvSrR7FJyxsDhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB6527 Return-Path: ray.ni@intel.com X-OriginatorOrg: 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: Tan, Dun > Sent: Thursday, March 23, 2023 3:41 PM > To: devel@edk2.groups.io > Cc: Dong, Eric ; Ni, Ray ; Kumar, > Rahul R ; Gerd Hoffmann > Subject: [Patch V4 02/21] UefiCpuPkg/CpuPageTableLib: Add check for input > Length >=20 > Add check for input Length in PageTableMap (). Return > RETURN_SUCCESS when input Length is 0. >=20 > Signed-off-by: Dun Tan > Cc: Eric Dong > Cc: Ray Ni > Cc: Rahul Kumar > Cc: Gerd Hoffmann > --- > UefiCpuPkg/Include/Library/CpuPageTableLib.h | 4 ++-- > UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c | 6 +++++- > 2 files changed, 7 insertions(+), 3 deletions(-) >=20 > diff --git a/UefiCpuPkg/Include/Library/CpuPageTableLib.h > b/UefiCpuPkg/Include/Library/CpuPageTableLib.h > index 2dc9b7d18e..5f44ece548 100644 > --- a/UefiCpuPkg/Include/Library/CpuPageTableLib.h > +++ b/UefiCpuPkg/Include/Library/CpuPageTableLib.h > @@ -1,7 +1,7 @@ > /** @file > Public include file for PageTableLib library. >=20 > - Copyright (c) 2022, Intel Corporation. All rights reserved.
> + Copyright (c) 2022 - 2023, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -81,7 +81,7 @@ typedef enum { > @retval RETURN_BUFFER_TOO_SMALL The buffer is too small for page > table creation/updating. > BufferSize is updated to indicate th= e expected buffer size. > Caller may still get RETURN_BUFFER_T= OO_SMALL with the > new BufferSize. > - @retval RETURN_SUCCESS PageTable is created/updated success= fully. > + @retval RETURN_SUCCESS PageTable is created/updated > successfully or the input Length is 0. > **/ > RETURN_STATUS > EFIAPI > diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c > b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c > index 52535e5a8d..218068a3e1 100644 > --- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c > +++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c > @@ -544,7 +544,7 @@ PageTableLibMapInLevel ( > @retval RETURN_BUFFER_TOO_SMALL The buffer is too small for page > table creation/updating. > BufferSize is updated to indicate th= e expected buffer size. > Caller may still get RETURN_BUFFER_T= OO_SMALL with the > new BufferSize. > - @retval RETURN_SUCCESS PageTable is created/updated success= fully. > + @retval RETURN_SUCCESS PageTable is created/updated > successfully or the input Length is 0. > **/ > RETURN_STATUS > EFIAPI > @@ -567,6 +567,10 @@ PageTableMap ( > IA32_PAGE_LEVEL MaxLeafLevel; > IA32_MAP_ATTRIBUTE ParentAttribute; >=20 > + if (Length =3D=3D 0) { > + return RETURN_SUCCESS; > + } > + > if ((PagingMode =3D=3D Paging32bit) || (PagingMode =3D=3D PagingPae) |= | > (PagingMode >=3D PagingModeMax)) { > // > // 32bit paging is never supported. > -- > 2.31.1.windows.1