From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 2BC4D74003D for ; Wed, 10 Jan 2024 09:09:31 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=9DHTP3AXMKUVe574nKvcGb7N3wZygKcQxBW1syfmuCw=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1704877770; v=1; b=jU0R2tqs8/4y4EkB2zSf3hBe5J1JvOxiOkf1BVs1ItC5DJwxOWl0uPo7gwRTOHFtd05+MvaF xjY+61+RJ2sL6+2IQ7V5LoLEDm5zJUCaEnouDWKSamPIj+w/YTP1dvdL/3a+4zUbQKbf2LlDaDO QbDDx0iltxaq3g/exY3+m5Lk= X-Received: by 127.0.0.2 with SMTP id CdD5YY7687511xu4tkwgfn7C; Wed, 10 Jan 2024 01:09:30 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web10.8002.1704877770011700659 for ; Wed, 10 Jan 2024 01:09:30 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10947"; a="484638093" X-IronPort-AV: E=Sophos;i="6.04,184,1695711600"; d="scan'208";a="484638093" X-Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2024 01:09:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,184,1695711600"; d="scan'208";a="16573071" X-Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmviesa002.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 10 Jan 2024 01:09:29 -0800 X-Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 10 Jan 2024 01:09:28 -0800 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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.35; Wed, 10 Jan 2024 01:09:28 -0800 X-Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Wed, 10 Jan 2024 01:09:28 -0800 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.168) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 10 Jan 2024 01:09:28 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kOeAzLansLZN86CdEHxD8lGiGTC/wVpcSkljRIYR8JEp+n7kCk8A0bRKt+dm8dhIECugQB8KCFcAU+27Iz5Kz5K/E0871oBCAR8n3Zx/CyznRNUYcnP4mqHy3k1UXSfqqdUcNn27Hepw8W/gcTJrVyZS+MSS8//eoT9mMeN9yrR8fK9yTNggLL+lSBGqLIyTtkiE4l5JNN4lmUH6kEMpTtK2H7Qw8QRoyEadOt1lN/DyTHBXH/oX1GcRzka0HDuBQ7tNLq9eUYN7+6fl/wsL5uF+sfWtNBzt2axpwBm1gO4eyLfFs02F0mE4EbjH6erkzfRmk9RKE0Fy4ycXQ18ROw== 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=q9zPL/HlFp88uDMxPu0EOVVWrp0rzEBPVWBNTIHqUAA=; b=mV2V/OV8rMJQIxeexY/qeYMb+NYOZfZMX/78iLYCLCGDiUH2Dm0g1mCGHFVFHBqbA4MJI0jO04kLPqucq2dv/Ghyeto0FxVDYTwo32W3hv70/YWj/DoqI7f5bzFy6My7IDAsORQyeqL3/F1zJEqHCktWlF5aRDjtyu9Ih0BA8G4/mD7iboSFQdLVbALYZ+NNJY5pYCTUHMP3a0kvPbvUVtlK1ls2g2RJvu5G/f8o9W+tqZJSfUsGrIeRUXuDjhMLcTnzHdFFD+hwEkRMZlOOBdkQd8m/x1C1oPRi+3lIjZe4OQ1chdx+7AqEcE9QfOeJK1d0ziy5a6lXDTmFOUhsEw== 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 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by SJ0PR11MB5038.namprd11.prod.outlook.com (2603:10b6:a03:2d8::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Wed, 10 Jan 2024 09:09:25 +0000 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::3fea:ca2b:2ef7:e3d4]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::3fea:ca2b:2ef7:e3d4%4]) with mapi id 15.20.7159.020; Wed, 10 Jan 2024 09:09:25 +0000 From: "Ni, Ray" To: "Liu, Zhiguang" , "devel@edk2.groups.io" CC: Laszlo Ersek , "Kumar, Rahul R" , Gerd Hoffmann , "Lee, Crystal" Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg: Fix issue that IsModified is wrongly set in PageTableMap Thread-Topic: [PATCH] UefiCpuPkg: Fix issue that IsModified is wrongly set in PageTableMap Thread-Index: AQHaQ4dJgW1PSI9Qo0mpHDb/eAvQGbDSwknA Date: Wed, 10 Jan 2024 09:09:25 +0000 Message-ID: References: <20240110053828.1473-1-zhiguang.liu@intel.com> In-Reply-To: <20240110053828.1473-1-zhiguang.liu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|SJ0PR11MB5038:EE_ x-ms-office365-filtering-correlation-id: 516da16f-defe-4dec-61a9-08dc11bbd7d6 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: iM4xHYuniNpk3uCr+xa6l/KaH9L7HuPQzP6ahYRLlRyobiFfBwp01z4X/6gYV+LLxkSsIhqGWMydRFB94e3jPgBr43cxcrWutsbCoM8aYsKW2Bwdta0mXc78GxSJoaEYukAgXASh2mLYLBKHnhYaZELiky0hIC33CdPGHe/hGx5IHM+qvLt8m8UALvxe1+WvB/+vS48N+2akr036WwHKIFiT5eCcOr4CHkDbazyq1y6rAQTwoxEC8cmN3Wm5iG8PnvCIUuHhYPXx8ZcQf/5nIkfOKJVjqzjcCgp3l0+IfFNWAaUWmlKDmcC+iAc1nbPunjBBMIYWPHFkXIJwxnc+8eGyQv11VUCj7gINIxRBCoTOzpc26jEd3POtAo+qB1Wrj9v3i+R2ZB3CGK38mHBDpohsUSSnBIs56JWci6tniwS+/gN2PChKZHcTb435GlD5+fYfNUZyC1+ODdjBZnYEVP+cJ61M1x5u0raL4m5xY01eXv5SRGOyereZG4GlLnOiVK5I3wEkK/0qlR1f9SrtaXdLBvaS92E4AON0x5YCZPJztTGtWOuRLDrVfro4860Vz3T9oBBQwk9Nw7Al2Xm0T2enhH4WkzY+vX03KkoWYA8= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ZmKEmjL8QqwKUjgq09cSGA/m+c0EyHHISagipN7xX+Zpm/M4upgA7E6dR6Qv?= =?us-ascii?Q?ZY2v2grfXN8jkifUmiOO3S347meAordgeICRaxTZe+YZpBj7ro97MyYLGImv?= =?us-ascii?Q?Cgw1MtWyV6gMAqgOkNSt0QciWvsoo6NyGlzYT+3977LQEedSPCnjVh4xJ6hP?= =?us-ascii?Q?z83V6wDQxWiWfMassIVO6LqfNuVNBpNxWN4VtI6/IKkqpAEA8ih5dLB70PYz?= =?us-ascii?Q?FV8DoqZaYle7aP2pRL7opjc11oRoXx4wCZDf9xH7f8rvOsd4EjuJ5UeMZB7S?= =?us-ascii?Q?e8wd/l3yfmAXHswvIvW+AQ6MoTKybp0UTPAMy6YEc3QBdfPNxFLfaoarOFG1?= =?us-ascii?Q?X1ivuSM+PMx7Tbf7530Y7W8hV7JcAJYQleRDTwPXmS3rAXprnHEfThXj8P/v?= =?us-ascii?Q?E6edmAXhBEJoWCY6l8i/Y6IaoJRxDBiPvQfPrb7R1V/6a/lM3u3RXYqzWSxA?= =?us-ascii?Q?DrGxaE5v6yF4CtdyakpKzwkEQa85kuHffQMBRmVHJ/w+vMKh41JHsqjxxBYG?= =?us-ascii?Q?kZj2szjQHyUrrP00dou7Ks67RVSEdtEnLdDBnZIu44FOzn2NCqQMXrPoYhZq?= =?us-ascii?Q?bqX65TGbszjZv9p03qIxxQ1306a7qaVIETFm2Vnf262eaEu8VX3D6o21/tHH?= =?us-ascii?Q?mOyDccF4w/89z+jbHOcqBfD8r5Oa67IPv8CRL+SlNGgYapzNAPn997eOOk6c?= =?us-ascii?Q?BUby5qbTHOh4o2lxSYC7+KJB7880YS3G5WhL89tSrUC18ATUvHpKPkBZqMlq?= =?us-ascii?Q?dck3i5uYeMFSEy/io/KWMK/0kaYRS4rjcMxwIdmK3eunpduFQ/KqrFcB/3aZ?= =?us-ascii?Q?3gLEVun3GeLEVMBrExfcKm0V7YuCMpNaLlg+garntCedSjCe8FDHDGenjkhC?= =?us-ascii?Q?KAOrvstP8a9JecT1zzyEFLSfYQt3ShsKko93c7QxoIs692EwDeZ2qRdyHPv5?= =?us-ascii?Q?YNB81/R1gp9l9TFs8La1D13b9F2ts18YCcxVZOv76M1qo33dbKjN2DhJFef4?= =?us-ascii?Q?sfDqlkogO/d9O6od/XRTRef+GVDRUPBVMw3s/GqIcZm06OzFIOsIxXr9ODVr?= =?us-ascii?Q?FBjv0UJXIJjWFCGM+K0eAohIzqCPrkquxc6kyxbINcB/nVC8CLpTye7kjkFo?= =?us-ascii?Q?/3n7uD5i2kEVn4bvFA8g/hN1gQFsE0V1A9AEzbLA3zmSvDB6vVKFXjrzsLjq?= =?us-ascii?Q?ET879U0D7s65PO6UA2apEQeUNuhpFOpprAS++daNF8lk7RagbmfqFZmpewdX?= =?us-ascii?Q?BEHaYqa5BWMNkaSmqAKXGMZHDwwqPIoPrVh5cFxZ3Rmob+zHkqJfRRcbAd8i?= =?us-ascii?Q?VclYV8ssXbI++XZA9WtSKG7YTYk5JY2fqcAaIh9gKffJibdvHq10yGkodltt?= =?us-ascii?Q?bR5faqW1fEyytsXA8qLqxo11RjL4KslOmOIp7a1twE/iA4MiHCE0HSLtmvs3?= =?us-ascii?Q?QAJVCfXFKKX9E1mCkAffp9Zd4G4FCLMxNb4Hgw5hKI16ZvwppntKpqKsEXyX?= =?us-ascii?Q?SgkVXlLX4cz9+M5Rf2G2+f3ISPoswvFQU+uZb/SJd9ciXUr5m9FHSCAmx81f?= =?us-ascii?Q?6+Q11K0OaZYgKZuTVZ0=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: 516da16f-defe-4dec-61a9-08dc11bbd7d6 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jan 2024 09:09:25.7410 (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: vJUxSfSky8GaoE5PLakrjgp1gBZhl4aeagnkZvAeGKSNarO4qtQrucnHOBmnlYO03stFD7Bzk6CXLEo7+El1Mw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5038 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 Reply-To: devel@edk2.groups.io,ray.ni@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: qMjIjVuRFNu9dE3HTA2g4SQ5x7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=jU0R2tqs; 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 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Reviewed-by: Ray Ni Thanks, Ray > -----Original Message----- > From: Liu, Zhiguang > Sent: Wednesday, January 10, 2024 1:38 PM > To: devel@edk2.groups.io > Cc: Liu, Zhiguang ; Ni, Ray ; L= aszlo > Ersek ; Kumar, Rahul R ; Gerd > Hoffmann ; Lee, Crystal > Subject: [PATCH] UefiCpuPkg: Fix issue that IsModified is wrongly set in > PageTableMap >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4614 >=20 > Fix issue that IsModified is wrongly set in PageTableMap. >=20 > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Rahul Kumar > Cc: Gerd Hoffmann > Cc: Crystal Lee > Signed-off-by: Zhiguang Liu > --- > UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) >=20 > diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c > b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c > index 36b2c4e6a3..164187f151 100644 > --- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c > +++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c > @@ -567,7 +567,10 @@ PageTableLibMapInLevel ( > OriginalCurrentPagingEntry.Uint64 =3D CurrentPagingEntry->Uint64= ; > PageTableLibSetPle (Level, CurrentPagingEntry, Offset, Attribute= , > &CurrentMask); >=20 > - if (OriginalCurrentPagingEntry.Uint64 !=3D CurrentPagingEntry->U= int64) { > + if (Modify && (OriginalCurrentPagingEntry.Uint64 !=3D CurrentPag= ingEntry- > >Uint64)) { > + // > + // The page table entry can be changed by this function only w= hen > Modify is true. > + // > *IsModified =3D TRUE; > } > } > @@ -609,7 +612,10 @@ PageTableLibMapInLevel ( > // Check if ParentPagingEntry entry is modified here is enough. Except= the > changes happen in leaf PagingEntry during > // the while loop, if there is any other change happens in page table,= the > ParentPagingEntry must has been modified. > // > - if (OriginalParentPagingEntry.Uint64 !=3D ParentPagingEntry->Uint64) { > + if (Modify && (OriginalParentPagingEntry.Uint64 !=3D ParentPagingEntry= - > >Uint64)) { > + // > + // The page table entry can be changed by this function only when Mo= dify > is true. > + // > *IsModified =3D TRUE; > } >=20 > -- > 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 (#113521): https://edk2.groups.io/g/devel/message/113521 Mute This Topic: https://groups.io/mt/103636407/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-