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.web10.3689.1660123617964328013 for ; Wed, 10 Aug 2022 02:26:58 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=BkrqI4zy; spf=pass (domain: intel.com, ip: 134.134.136.24, 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=1660123618; x=1691659618; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=1m1FVDuxyH/41s1QeJv2mQqAAp0t3w8JY+QlhS6JyUw=; b=BkrqI4zy46iKUDNFhhv9sB5/iGAdEexh2uomGJ5t9kRnYjGMGzBQMdsO SLjM4ov3KAWIgkoBO38Z3kt+H8dpwf+Se1wMY3hju459mIREcoewiLRZq zaW/Benpok5Yje0FYeOO4r4Htc1GYOziTCW21pxmEz5zkDDq4WCITOEWm dXvGgx0mMJZoq49QBu5l3sF8gIbhtz1HIjvHo0I01xlpzOX72JZrOpZso ZmDi0l5cU/o77oAjeVjk90Xvtfom7Ensd7trz0qbOZpg3XCTppxkQoIx9 en41WjikfNBsKFZ30hVNDt+x58umqa4QFyjMW5KNhYv3w+IPPU2/HNrcA w==; X-IronPort-AV: E=McAfee;i="6400,9594,10434"; a="291829306" X-IronPort-AV: E=Sophos;i="5.93,226,1654585200"; d="scan'208";a="291829306" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2022 02:26:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,226,1654585200"; d="scan'208";a="608507964" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga007.fm.intel.com with ESMTP; 10 Aug 2022 02:26:58 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) 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.2375.28; Wed, 10 Aug 2022 02:26:57 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 10 Aug 2022 02:26:57 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) 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.2375.28 via Frontend Transport; Wed, 10 Aug 2022 02:26:57 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.101) 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.2375.28; Wed, 10 Aug 2022 02:26:56 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LugRa8654vpYtlcRm5KJ2hOp2Fm1d5gVWAFZvS7LcRwttrVwzW1mYhJOfmX0fFqCH3vml8Ga0uDrYc8IJHwlIp5woiVMfhhm//oMZQJIyzYOel5+jA+WDasyoCiHamH65z3Er4C9jbbGStuBve2u4crGCxSyRXU0c09hk0bJwpw7CLqnyO+LmwmdQ0a9uHZDkfTC2B+LEKZ84xfQajHS7386/E9Mwkwy0kzOQtoQAwltkB7fVN1kRtJAHosQgAxHpVXCaTgpPPrX8L7hVEdCS5+C1ibtgg8J43cu6vwB1vrFDdlOXsxSwsCTZElKvq5GnzFVxkwMBnPEx7saP+l4KA== 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=vx4DGwzbF37dMgSLLFVUIm9Z+2w53qXrmgSsGH48HOw=; b=maJNBYVQJNrYHh/1Q8Qwgly2bsNRwgcuhMC/zgPEherhiEecTSna8B54T2EDye1K7SNy2f+/g7xuMjdPMCHRT2mxnDJBYhmeeCvPx26ZhqaXwkIte6jQPQ9mNjWEywfPVTRdIX1kfgrDTAakP6YD51QXa+X29RagtYO9CPuYTTRn1Jh6cTgvxDvhNoiFszEojEww3+/+ZmJORUKd4qCFClnUUX3JcGJkkfeWgzitTRRclFfoXstTQvTRKWiPV1YVhcimIlt7rgV463+odIiIkENflL8j6uAQ4K4S28C1/tqDG2E05wiFyh9MLyWAJ4YnqEZyf/NMpmQXXvjJrjU/Jg== 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 MWHPR11MB1631.namprd11.prod.outlook.com (2603:10b6:301:10::10) by DM6PR11MB3674.namprd11.prod.outlook.com (2603:10b6:5:13d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.11; Wed, 10 Aug 2022 09:26:43 +0000 Received: from MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::991b:97a0:7836:5174]) by MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::991b:97a0:7836:5174%10]) with mapi id 15.20.5504.020; Wed, 10 Aug 2022 09:26:43 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" CC: "Bi, Dandan" , "Gao, Liming" Subject: Re: [Patch V2 1/2] MdeModulePkg/DxeIpl: Remove clearing CR0.WP when protecting pagetable Thread-Topic: [Patch V2 1/2] MdeModulePkg/DxeIpl: Remove clearing CR0.WP when protecting pagetable Thread-Index: AQHYrHrlkfqpiGi7dkSiZCogOlZaga2n3UFA Date: Wed, 10 Aug 2022 09:26:43 +0000 Message-ID: References: <20220810053400.317-1-dun.tan@intel.com> <20220810053400.317-2-dun.tan@intel.com> In-Reply-To: <20220810053400.317-2-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-office365-filtering-correlation-id: 8c191ce7-7c62-4a72-f924-08da7ab27084 x-ms-traffictypediagnostic: DM6PR11MB3674:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: vS2lU74sX5XRCfBXuPzVoscAyUF8aOkTVPYuhbfJJqH7oUGythk9sD1aUT3OxmEamd/mxra+iahlW3iK+djtt1r2JwdZxBGGiD/CBJOmODhSB8znyuc7uD1pAhfG2PPyEYU7uPbSBV/dMeJl+Z/zYstQe7rQtO5hNVoxbtDKH6wczxll4wu8vBKjfZc9kVz8PUZ06dVb9mYyV4NwWAZAebnrcidAsKw5OebWHb001MhDtgJ4NwYb1uU8YPWQapsh1PBESQT1dMzEORKL4L3UeF3a8mzrKROQrJPpWVyeQiGY25bWX7jLDfRGEuxZGEpn4iHda3lkf9xgpfbBOH8I65oOtCt50X65U65Ix7PIlpOMuylggyI7SElzz1C4a1tE8SW14bjEA84U6qGfqYVcYRtQlnIpLU7sSSKzS9LIDgzOdM0tGBaXbwDdlKDQg4E/1KcM/xd4UpHVJH1Xk6kMpeUpuZE0PtwRPievRhZ6/ZZHEdb+euQcm23HhzdRQGa4/RQdRmoFNuaCAPtDt34pmdxMoEK/6JVQi/Smud5s5aMAtkkjgaDsV+XbLfP6OXiQvi+NAOlvdHD8pPgxfE9f//bdfDXs1mLYDVA3Dln51AVBXOrheu3B8fTqiNYKM+wc09bIJvHuMzo/zzhMybyG3Idr0bQWKajBj0/zdd2f+PN+R+CNVbDfPfy0eBpLA0DhGyAM1nu+Phxtk5zNSnvhhm4X5vo1bQXkzJYrQ8QmG+S/jb2FUuIjjeTshvMQ0SFzOY3QAAFhypG6/6zlQBunXbIcCiObdbzkn9FjL+OqR6kqxIQoB3E2qUuB5W0mnseO x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1631.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(39860400002)(366004)(376002)(396003)(346002)(82960400001)(38070700005)(122000001)(38100700002)(86362001)(8936002)(52536014)(71200400001)(5660300002)(110136005)(54906003)(19627235002)(316002)(4326008)(8676002)(64756008)(66446008)(66476007)(66556008)(66946007)(76116006)(186003)(9686003)(83380400001)(55016003)(33656002)(26005)(478600001)(2906002)(6506007)(7696005)(53546011)(41300700001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?cXeGNbJZ7taB4CJxfHSqRzay8Bl7n34JWliVV4wkZ6RolTwiLO9I7zqvaRYQ?= =?us-ascii?Q?bivJuVfw983VytrlVXDvycCTiBTaoadsnIMFdYLDEWA4EhReQU1SRMMiwc6S?= =?us-ascii?Q?UAsm/bwBtlc/wMmbvnd2bNDgYwVbgJW3+w/WnrME9OKT45LnknGlMWRjaCdU?= =?us-ascii?Q?XXuB+tjtTcMeG99AqICsA742UqJaiHABYVISJmgkhLtz9qwon6x8oGeb+nAA?= =?us-ascii?Q?0NFVUmow6QLPfUd9OKli7yzVY45wvMK81X1Ky9yuZDr8caO4zr+RhUPHGD1O?= =?us-ascii?Q?to4DH9H54WkMZg8vnex4QP59M4HHmwcBpiNne0yPrK3pft/Lv+SPILKVmrPv?= =?us-ascii?Q?rbp2pnS0PcIx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-ascii?Q?ZKGPn5VUBEXHj8x5ON6QvX5TeUfP4ukJ8jjfIXAEm0F/jXuNTF5dsblyzW9c?= =?us-ascii?Q?EkxwOZHaLGDlUTe08Rb8YedM6teEWnk0dsj1kGTteTdgrv22tJmWhVscf+xi?= =?us-ascii?Q?c5JOcpfGRAig+Qh5+0zqVsEKZLBjmmjraUFKIF4nMC997pK7GDhsLxZoV0FA?= =?us-ascii?Q?szOHaJSQCIA7+mXNfRgybHsW8PU3gHMYuMtqkKzZHI7LtFWdieYBxtp0CMfx?= =?us-ascii?Q?1SujLEQkAeIexcmmySJ70ZDa9qjVLU6hfh6ifntE5xgKNZsR8gw4P01pkKTR?= =?us-ascii?Q?LTndwB0NRYBcOLwzfwQPEhu8OFhDQIGYIuhM249L?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1631.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c191ce7-7c62-4a72-f924-08da7ab27084 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Aug 2022 09:26:43.6720 (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: nEoxBq4dINDEn3hnuMAWedt44CtWPZ1BYhREuJdq6haimSazIAVQvQJAB+UmYZGRzEE6OfBoiXVFRQJYc0DAvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3674 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: Wednesday, August 10, 2022 1:34 PM > To: devel@edk2.groups.io > Cc: Bi, Dandan ; Gao, Liming > ; Ni, Ray > Subject: [Patch V2 1/2] MdeModulePkg/DxeIpl: Remove clearing CR0.WP > when protecting pagetable >=20 > Remove clearing CR0.WP when marking the memory used for page table > as read-only in the page table itself created by DxeIpl. This page > table address is written to Cr3 after these protection steps. Till > this, the memory used for page table is always RW. >=20 > Signed-off-by: Dun Tan > Cc: Dandan Bi > Cc: Liming Gao > Cc: Ray Ni > --- > MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) >=20 > diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c > b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c > index a451ca1604..18b121d768 100644 > --- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c > +++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c > @@ -626,12 +626,7 @@ EnablePageTableProtection ( > } >=20 > // > - // Disable write protection, because we need to mark page table to be > write > - // protected. > - // > - AsmWriteCr0 (AsmReadCr0 () & ~CR0_WP); > - > - // > + // No need to clear CR0.WP since PageTableBase has't been written to C= R3 > yet. > // SetPageTablePoolReadOnly might update mPageTablePool. It's safer to > // remember original one in advance. > // > -- > 2.31.1.windows.1