From nobody Mon Feb 9 01:16:25 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+92287+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+92287+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1660109680; cv=none; d=zohomail.com; s=zohoarc; b=AZoHn3NX5vg1iN13TpeVpMyYJeGcdAQPY2hdnnYNMq9/oaqhOrFPzAQqfEvjwpuVuPdAUZD8IFmJmCzGXfXqlLEmYCaVFQSm8SDDb8dIquoHLXxLo1Aru+3qQRhJlwCtqBf0nLqruEyW4NNRLSiS37f5bQX7Q2HX+mdFEGWrZPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660109680; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=DdMbDBPeQsSwSZCBQ4TcIBNIyzXaesMW8hVHStsMFHw=; b=jYfwOt4qInws5AeyFL5PV/ZXCz/Hau/8tIXuWy3EekSF06fwVEe9EAdVOYWreD5LZsCQk1HypG5IUHASMldTYDcTyVzX0KwPPpzdd5P0DErXBAFhZIhEZ1oQSUiwyJHWljgQcLdzVY7is7aG3EvF3Ts4R4kxKv8dqYW6uf8KakY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+92287+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1660109680377805.0051472287174; Tue, 9 Aug 2022 22:34:40 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id pOsFYY1788612xCpgTfvNOUA; Tue, 09 Aug 2022 22:34:39 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.2539.1660109672243652742 for ; Tue, 09 Aug 2022 22:34:38 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10434"; a="291002920" X-IronPort-AV: E=Sophos;i="5.93,226,1654585200"; d="scan'208";a="291002920" X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2022 22:34:38 -0700 X-IronPort-AV: E=Sophos;i="5.93,226,1654585200"; d="scan'208";a="581093874" X-Received: from duntan-mobl.ccr.corp.intel.com ([10.239.157.47]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2022 22:34:36 -0700 From: "duntan" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Maurice Ma , Benjamin You , Sean Rhodes Subject: [edk2-devel] [Patch V2 2/2] UefiPayloadPkg: Remove clearing CR0.WP when protecting pagetable Date: Wed, 10 Aug 2022 13:34:00 +0800 Message-Id: <20220810053400.317-3-dun.tan@intel.com> In-Reply-To: <20220810053400.317-1-dun.tan@intel.com> References: <20220810053400.317-1-dun.tan@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,dun.tan@intel.com X-Gm-Message-State: tJSqR3g0IAMJJrSGJiEA7RFbx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1660109679; bh=JAAnQAfCRQJxX3baksyJGirdAyPtAQA30zYsEV8g/Qc=; h=Cc:Date:From:Reply-To:Subject:To; b=TccoJQmh1TPwtoAWf4dwTNYG7pvR12vnRuRDJa03e8oRJm3IlI5i4S6Xpym7k5mV72b J1/yXz6RrY+Hg1y4+TQ+cXVvsbXl82BXCjrgfVOvFSmvn9hL4OB3REoRHRde2k8WedSbl 94ly2IXnJnhCBLXwaggbivckqDydAxsizRs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1660109681379100001 Content-Type: text/plain; charset="utf-8" Remove clearing CR0.WP when marking the memory used for page table as read-only in the page table itself created by UefiPayloadEntry. This page table address is written to Cr3 after these protection steps. Till this, the memory used for page table is always RW. Signed-off-by: Dun Tan Cc: Guo Dong Cc: Ray Ni Cc: Maurice Ma Cc: Benjamin You Cc: Sean Rhodes Reviewed-by: Guo Dong Reviewed-by: Ray Ni --- UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c b/UefiPayl= oadPkg/UefiPayloadEntry/X64/VirtualMemory.c index 74b667a62a..a586941352 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c +++ b/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c @@ -622,12 +622,7 @@ EnablePageTableProtection ( } =20 // - // Disable write protection, because we need to mark page table to be wr= ite - // protected. - // - AsmWriteCr0 (AsmReadCr0 () & ~CR0_WP); - - // + // No need to clear CR0.WP since PageTableBase has't been written to CR3= yet. // SetPageTablePoolReadOnly might update mPageTablePool. It's safer to // remember original one in advance. // --=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 (#92287): https://edk2.groups.io/g/devel/message/92287 Mute This Topic: https://groups.io/mt/92931316/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-