public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Tan, Dun" <dun.tan@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Bi, Dandan" <dandan.bi@intel.com>,
	"Gao, Liming" <gaoliming@byosoft.com.cn>
Subject: Re: [Patch V2 1/2] MdeModulePkg/DxeIpl: Remove clearing CR0.WP when protecting pagetable
Date: Wed, 10 Aug 2022 09:26:43 +0000	[thread overview]
Message-ID: <MWHPR11MB1631693FC186E1B797E58CDE8C659@MWHPR11MB1631.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220810053400.317-2-dun.tan@intel.com>

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Tan, Dun <dun.tan@intel.com>
> Sent: Wednesday, August 10, 2022 1:34 PM
> To: devel@edk2.groups.io
> Cc: Bi, Dandan <dandan.bi@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com>
> Subject: [Patch V2 1/2] MdeModulePkg/DxeIpl: Remove clearing CR0.WP
> when protecting pagetable
> 
> 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.
> 
> Signed-off-by: Dun Tan <dun.tan@intel.com>
> Cc: Dandan Bi <dandan.bi@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Ray Ni <ray.ni@intel.com>
> ---
>  MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> 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 (
>    }
> 
>    //
> -  // 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 CR3
> yet.
>    // SetPageTablePoolReadOnly might update mPageTablePool. It's safer to
>    // remember original one in advance.
>    //
> --
> 2.31.1.windows.1


  reply	other threads:[~2022-08-10  9:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10  5:33 [Patch V2 0/2] Remove clearing CR0.WP when protecting pagetable duntan
2022-08-10  5:33 ` [Patch V2 1/2] MdeModulePkg/DxeIpl: " duntan
2022-08-10  9:26   ` Ni, Ray [this message]
2022-08-10  5:34 ` [Patch V2 2/2] UefiPayloadPkg: " duntan
2022-08-10  9:26   ` Ni, Ray
2022-08-12 22:57   ` Guo Dong
2022-08-10  5:41 ` [edk2-devel] [Patch V2 0/2] " Ni, Ray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MWHPR11MB1631693FC186E1B797E58CDE8C659@MWHPR11MB1631.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox