From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 5408F941424 for ; Fri, 17 May 2024 11:41:04 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=4fERieaGnN1C+Iyx6tRWdda/3XxDlP1Y4OVav1OdV8k=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type; s=20240206; t=1715946062; v=1; b=MBHHM+eKmcAeW/kczm4VrYDO7NZwYN4aSpplnPsyAGW3CTwmr3x5Nl9lSJYigJ2PA9awqM8n /2030bcPssDkRK3FNBPmoHANLm9JMRq0b02oW6wNO4S6xjIMNaiyEVTrY9S2qMokBTJ3oD+nFN0 kH+TpDdgDkW/dZ8NkEKPlAEcS/nZqsVUc2GvjadX4E40ILXmSbQqjjIjr3PQv63dZtS/BpzgvmD nbsAfD4qxk7h6ei7KdX2o2Gmt9qOG4Zji1nkftaWFFS1ms3MT2eW4D8CsGCGk9kVxNy0CujRwjp ZtgLaq9gcow0UZbU2CtPj+bQ7voqCfCzdTi45dzj/lQ2Q== X-Received: by 127.0.0.2 with SMTP id 3pKsYY7687511xGFMPLj6z1K; Fri, 17 May 2024 04:41:02 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by mx.groups.io with SMTP id smtpd.web10.37869.1715946061171472462 for ; Fri, 17 May 2024 04:41:01 -0700 X-CSE-ConnectionGUID: a6Jd3cbMQumotSOvHXFlFg== X-CSE-MsgGUID: HwRmaWG6QFS/yChZoqo2iA== X-IronPort-AV: E=McAfee;i="6600,9927,11074"; a="15944033" X-IronPort-AV: E=Sophos;i="6.08,167,1712646000"; d="scan'208,217";a="15944033" X-Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 04:41:01 -0700 X-CSE-ConnectionGUID: DEIgZqbzRXGl6sawql/+Dg== X-CSE-MsgGUID: KP8quThSQRaWkMB21+GThQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,167,1712646000"; d="scan'208,217";a="36665480" X-Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa004.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 17 May 2024 04:41:00 -0700 X-Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 17 May 2024 04:40:59 -0700 X-Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) 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.39; Fri, 17 May 2024 04:40:59 -0700 X-Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) 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.39 via Frontend Transport; Fri, 17 May 2024 04:40:59 -0700 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.169) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 17 May 2024 04:40:59 -0700 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by DM4PR11MB8180.namprd11.prod.outlook.com (2603:10b6:8:18d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.30; Fri, 17 May 2024 11:40:57 +0000 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::41a4:c775:32e6:76a8]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::41a4:c775:32e6:76a8%4]) with mapi id 15.20.7587.028; Fri, 17 May 2024 11:40:57 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" CC: "Kumar, Rahul R" , Gerd Hoffmann , "Wu, Jiaxin" , "Zhou, Jianfeng" Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg:fix issue when splitting paging entry Thread-Topic: [PATCH] UefiCpuPkg:fix issue when splitting paging entry Thread-Index: AQHaqD70QS0GThWxSEeNAI6k8nmVY7GbTZSh Date: Fri, 17 May 2024 11:40:57 +0000 Message-ID: References: <20240517094458.2068-1-dun.tan@intel.com> In-Reply-To: <20240517094458.2068-1-dun.tan@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|DM4PR11MB8180:EE_ x-ms-office365-filtering-correlation-id: a8e51501-e6b2-4f4d-bab2-08dc766637a7 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?ooVypmD/G9QWtwEoHzMm9VRCephl7rExA3WwS4fT5V6CpwL4MHxWpwBVuxrt?= =?us-ascii?Q?NYqfiLvJTi3AEKaoU9A0oyeKqUZaZgGaFmG2g9zMop5g291UVWpR8kDZJY7T?= =?us-ascii?Q?QBNaqs7hxm4ZKVl4vBZ56ewZg+STJW8JyQ6bZBdKGOxI4ZUVF7TJ6mNU4QxL?= =?us-ascii?Q?lXJkn0PdbLQ3o7hhuc4pds/5LPR6NApWCyjJlmg1tem/VcA7g5lQFdXA7svo?= =?us-ascii?Q?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GYAc8?= =?us-ascii?Q?1feV+ge3G85llPnNHhLJzg2/GI7a5IPTZpliBav+SBwe7cF3FBD+cohmltgc?= =?us-ascii?Q?x51SJJU6jdQ+trY0HfdBduoftTjjESjxxb1YMu9dewsR5kOY2GhAcATZS1aN?= =?us-ascii?Q?iDeBV/mvtqamx+wUOV0qnCBtIojnij8xuie8lay4hKArlFjhHYqE2+lptCDH?= =?us-ascii?Q?YPiBeCe1nO1ivfpQ4HObqW01OJ2yC9FXeQQ62e0ChHmApA=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?BkACS29kqAfbRPKaYDk7uOM9vo1dzDU0paDzEE4BuJ0Yz+bUhFsWHCq6+2x/?= =?us-ascii?Q?MPYDjJWxbsjCmxOLGISq50F3sn2d8HL2FGWGU5QT3IiHyUYpeOPrBN1JgpYG?= =?us-ascii?Q?qitDQdFM6qx/S7z7d/Q03dvMJ3uaR9lMA5VK1Inn41nnjTuYeHCzeMNv1yEm?= =?us-ascii?Q?3yumO353Gev2jEj8y6EsmgraqL3X2iB2KxmrDhcS5tdJwIiGpbQe7IWKke83?= =?us-ascii?Q?peUiiiDnetJDpixkbGJTLtDXMp+mjImRtWY+KnDsNSg3GHmiRotp9v6ouprX?= =?us-ascii?Q?Uj8VEPtTvYnU4j6ryBgsabFRIArY1hdi/H0++BBUKJPOxc1RUuMiDU/qhh7h?= =?us-ascii?Q?4bz+2fqDascP2U6jPPH29upbodcgJg/rcrJIEg0s3o4bgYGtAUdQ+1yXc3ng?= =?us-ascii?Q?7mkDs18teucYKF7jHEqhDM9n0y+Bv/nQko4TKIIZPfL4xrxVQgJZ3mmP3+pc?= =?us-ascii?Q?KlDt+xLUrkWWey9Ol22qlOcrOpwhUFxinWCrlehG1oWj0NUAuLUOIzPWsnsX?= =?us-ascii?Q?gnznEFPfSshkJzm2YQuwQknGiylFhHvcEcpt2Rul6ddqU9Y8gxpqcQVMMNUS?= =?us-ascii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+N/VGGh6kRENcKsyNFqN8?= =?us-ascii?Q?tsRgHuvsYZbz94PHdDHKdH2QZ/BJRtm1nRGWBzzy4HGqzukJhCWhsevV2vEi?= =?us-ascii?Q?2wPiVmmeDUSlo3gSZfY=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: a8e51501-e6b2-4f4d-bab2-08dc766637a7 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 May 2024 11:40:57.2147 (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: hHnwI0i1GJbiPxS8R/a2kFKqmnJj2vozMt/l0dMl+hQxZz6ym9WiyXm2B4SZnk1Ta2nV+BrxtCZVRitDYUGNIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB8180 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Fri, 17 May 2024 04:41:01 -0700 Resent-From: ray.ni@intel.com Reply-To: devel@edk2.groups.io,ray.ni@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: MfQKgJou07TZdnx73ZhdxkUFx7686176AA= Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MN6PR11MB824462B720D17E1F0C1584218CEE2MN6PR11MB8244namp_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=MBHHM+eK; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io --_000_MN6PR11MB824462B720D17E1F0C1584218CEE2MN6PR11MB8244namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni Thanks, Ray ________________________________ From: Tan, Dun Sent: Friday, May 17, 2024 17:44 To: devel@edk2.groups.io Cc: Ni, Ray ; Kumar, Rahul R ; G= erd Hoffmann ; Wu, Jiaxin ; Zhou, J= ianfeng Subject: [PATCH] UefiCpuPkg:fix issue when splitting paging entry This patch is to fix issue when splitting leaf paging entry in CpuPageTableLib code. In previous code, before we assign the new child paging structure address to the content of splitted paging entry, PageTableLibSetPnle() is called to make sure the bit7 is set to 0, which indicate the previous leaf entry is changed to non-leaf entry now. There is a gap between we change the bit7 and we assign the new child paging structure address to the content of the splitted paging entry. If the address of code execution or data access happens to be in the range covered by the splitted paging entry, this gap may cause issue. In this patch, we prepare the new paging entry content value in a local variable and assign the value to the splitted paging entry at once. The volatile keyword is used to ensure that no optimization will occur in compilation. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu Cc: Zhou Jianfeng --- UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c b/UefiCpu= Pkg/Library/CpuPageTableLib/CpuPageTableMap.c index b10a3008e4..bdc411338f 100644 --- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c +++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c @@ -342,6 +342,7 @@ PageTableLibMapInLevel ( UINT64 PhysicalAddrInAttr; IA32_PAGING_ENTRY OriginalParentPagingEntry; IA32_PAGING_ENTRY OriginalCurrentPagingEntry; + IA32_PAGING_ENTRY TempPagingEntry; ASSERT (Level !=3D 0); ASSERT ((Attribute !=3D NULL) && (Mask !=3D NULL)); @@ -359,6 +360,8 @@ PageTableLibMapInLevel ( OriginalParentPagingEntry.Uint64 =3D ParentPagingEntry->Uint64; OneOfPagingEntry.Uint64 =3D 0; + TempPagingEntry.Uint64 =3D 0; + // // RegionLength: 256T (1 << 48) 512G (1 << 39), 1G (1 << 30), 2M (1 << 2= 1) or 4K (1 << 12). // @@ -441,8 +444,10 @@ PageTableLibMapInLevel ( // Non-leaf entry doesn't have PAT bit. So use ~IA32_PE_BASE_ADDRESS= _MASK_40 is to make sure PAT bit // (bit12) in original big-leaf entry is not assigned to PageTableBa= seAddress field of non-leaf entry. // - PageTableLibSetPnle (&ParentPagingEntry->Pnle, &NopAttribute, &AllOn= eMask); - ParentPagingEntry->Uint64 =3D ((UINTN)(VOID *)PagingEntry) | (Parent= PagingEntry->Uint64 & (~IA32_PE_BASE_ADDRESS_MASK_40)); + TempPagingEntry.Uint64 =3D ParentPagingEntry->Uint64; + PageTableLibSetPnle (&TempPagingEntry.Pnle, &NopAttribute, &AllOneMa= sk); + TempPagingEntry.Uint64 =3D ((UINTN)(VOID *= )PagingEntry) | (TempPagingEntry.Uint64 & (~IA32_PE_BASE_ADDRESS_MASK_40)); + *(volatile UINT64 *)&(ParentPagingEntry->Uint64) =3D TempPagingEntry= .Uint64; } } else { // -- 2.31.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#119039): https://edk2.groups.io/g/devel/message/119039 Mute This Topic: https://groups.io/mt/106150750/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --_000_MN6PR11MB824462B720D17E1F0C1584218CEE2MN6PR11MB8244namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Ray Ni <ray.ni@intel.com>

Thanks,
Ray

From: Tan, Dun <dun.tan@= intel.com>
Sent: Friday, May 17, 2024 17:44
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com>; Kumar, Rahul R <rahul.r.kum= ar@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Wu, Jiaxin <j= iaxin.wu@intel.com>; Zhou, Jianfeng <jianfeng.zhou@intel.com>
Subject: [PATCH] UefiCpuPkg:fix issue when splitting paging entry
 
This patch is to fix issue when splitting leaf pag= ing
entry in CpuPageTableLib code.

In previous code, before we assign the new child paging
structure address to the content of splitted paging entry,
PageTableLibSetPnle() is called to make sure the bit7 is
set to 0, which indicate the previous leaf entry is
changed to non-leaf entry now. There is a gap between
we change the bit7 and we assign the new child paging
structure address to the content of the splitted paging
entry. If the address of code execution or data access
happens to be in the range covered by the splitted paging
entry, this gap may cause issue.

In this patch, we prepare the new paging entry content
value in a local variable and assign the value to the
splitted paging entry at once. The volatile keyword
is used to ensure that no optimization will occur in
compilation.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Zhou Jianfeng <jianfeng.zhou@intel.com>
---
 UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c | 9 +++++++--  1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c b/UefiCpu= Pkg/Library/CpuPageTableLib/CpuPageTableMap.c
index b10a3008e4..bdc411338f 100644
--- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
+++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
@@ -342,6 +342,7 @@ PageTableLibMapInLevel (
   UINT64         &n= bsp;    PhysicalAddrInAttr;
   IA32_PAGING_ENTRY   OriginalParentPagingEntry;
   IA32_PAGING_ENTRY   OriginalCurrentPagingEntry;
+  IA32_PAGING_ENTRY   TempPagingEntry;
 
   ASSERT (Level !=3D 0);
   ASSERT ((Attribute !=3D NULL) && (Mask !=3D NULL)); @@ -359,6 +360,8 @@ PageTableLibMapInLevel (
 
   OriginalParentPagingEntry.Uint64 =3D ParentPagingEntry->Uin= t64;
   OneOfPagingEntry.Uint64      &nb= sp;   =3D 0;
+  TempPagingEntry.Uint64       &nb= sp;   =3D 0;
+
   //
   // RegionLength: 256T (1 << 48) 512G (1 << 39), 1G= (1 << 30), 2M (1 << 21) or 4K (1 << 12).
   //
@@ -441,8 +444,10 @@ PageTableLibMapInLevel (
       // Non-leaf entry doesn't have PAT bit= . So use ~IA32_PE_BASE_ADDRESS_MASK_40 is to make sure PAT bit
       // (bit12) in original big-leaf entry = is not assigned to PageTableBaseAddress field of non-leaf entry.
       //
-      PageTableLibSetPnle (&ParentPagingEntry= ->Pnle, &NopAttribute, &AllOneMask);
-      ParentPagingEntry->Uint64 =3D ((UINTN)(V= OID *)PagingEntry) | (ParentPagingEntry->Uint64 & (~IA32_PE_BASE_ADD= RESS_MASK_40));
+      TempPagingEntry.Uint64 =3D ParentPagingEntr= y->Uint64;
+      PageTableLibSetPnle (&TempPagingEntry.P= nle, &NopAttribute, &AllOneMask);
+      TempPagingEntry.Uint64   &nb= sp;            =            =3D ((UINTN)(V= OID *)PagingEntry) | (TempPagingEntry.Uint64 & (~IA32_PE_BASE_ADDRESS_M= ASK_40));
+      *(volatile UINT64 *)&(ParentPagingEntry= ->Uint64) =3D TempPagingEntry.Uint64;
     }
   } else {
     //
--
2.31.1.windows.1

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#119039) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--_000_MN6PR11MB824462B720D17E1F0C1584218CEE2MN6PR11MB8244namp_--