public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "duntan" <dun.tan@intel.com>
To: "Ni, Ray" <ray.ni@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Dong, Eric" <eric.dong@intel.com>,
	"Kumar, Rahul R" <rahul.r.kumar@intel.com>
Subject: Re: [edk2-devel] [PATCH 1/2] UefiCpuPkg/PiSmmCpuDxeSmm: Add a new IsShadowStack flag
Date: Wed, 10 Aug 2022 04:02:52 +0000	[thread overview]
Message-ID: <BN9PR11MB54831A53F31B65388EC39D4FE5659@BN9PR11MB5483.namprd11.prod.outlook.com> (raw)
In-Reply-To: <MWHPR11MB163116940ACD98E58B7829AA8C659@MWHPR11MB1631.namprd11.prod.outlook.com>

Ok, I'll send the V2 patch set soon.

Thanks,
Dun

-----Original Message-----
From: Ni, Ray <ray.ni@intel.com> 
Sent: Wednesday, August 10, 2022 11:52 AM
To: devel@edk2.groups.io; Tan, Dun <dun.tan@intel.com>
Cc: Dong, Eric <eric.dong@intel.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>
Subject: RE: [edk2-devel] [PATCH 1/2] UefiCpuPkg/PiSmmCpuDxeSmm: Add a new IsShadowStack flag

Dun,
Can you please update the commit message to explain it's a code refactoring and doesn't change any functionality? Also explain why such refactoring is needed.

IsShadowStack: the name doesn't follow EDKII coding style.
You need to use "mIsShadowStack".

Thanks,
Ray

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of duntan
> Sent: Wednesday, August 10, 2022 9:46 AM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; 
> Kumar, Rahul R <rahul.r.kumar@intel.com>
> Subject: [edk2-devel] [PATCH 1/2] UefiCpuPkg/PiSmmCpuDxeSmm: Add a new 
> IsShadowStack flag
> 
> Add a new IsShadowStack flag to identify whether current memory is 
> shadow stack. The dirty bit in page table entry for this memory will 
> be set if IsShadowStack is TRUE, instead of depending on mInternalCr3.
> 
> Signed-off-by: Dun Tan <dun.tan@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 8
> +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git
> a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> index 1f7cc15727..b369c0c435 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> @@ -33,6 +33,7 @@ PAGE_ATTRIBUTE_TABLE  mPageAttributeTable[] = {  };
> 
>  UINTN  mInternalCr3;
> +UINTN  IsShadowStack = FALSE;
> 
>  /**
>    Set the internal page table base address.
> @@ -249,7 +250,7 @@ ConvertPageEntryAttribute (
>    if ((Attributes & EFI_MEMORY_RO) != 0) {
>      if (IsSet) {
>        NewPageEntry &= ~(UINT64)IA32_PG_RW;
> -      if (mInternalCr3 != 0) {
> +      if (IsShadowStack) {
>          // Environment setup
>          // ReadOnly page need set Dirty bit for shadow stack
>          NewPageEntry |= IA32_PG_D;
> @@ -734,10 +735,11 @@ SetShadowStack (
>    EFI_STATUS  Status;
> 
>    SetPageTableBase (Cr3);
> -
> -  Status = SmmSetMemoryAttributes (BaseAddress, Length, 
> EFI_MEMORY_RO);
> +  IsShadowStack = TRUE;
> +  Status        = SmmSetMemoryAttributes (BaseAddress, Length,
> EFI_MEMORY_RO);
> 
>    SetPageTableBase (0);
> +  IsShadowStack = FALSE;
> 
>    return Status;
>  }
> --
> 2.31.1.windows.1
> 
> 
> 
> 
> 


  reply	other threads:[~2022-08-10  4:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10  1:45 [PATCH 0/2] Remove mInternalCr3 in PiSmmCpuDxeSmm duntan
2022-08-10  1:45 ` [PATCH 1/2] UefiCpuPkg/PiSmmCpuDxeSmm: Add a new IsShadowStack flag duntan
2022-08-10  3:51   ` [edk2-devel] " Ni, Ray
2022-08-10  4:02     ` duntan [this message]
2022-08-10  1:45 ` [PATCH 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: Remove mInternalCr3 in PiSmmCpuDxeSmm duntan
2022-08-10  5:20   ` Ni, Ray
2022-08-10  3:20 ` [edk2-devel] [PATCH 0/2] " Sean
2022-08-10  4:03   ` duntan

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=BN9PR11MB54831A53F31B65388EC39D4FE5659@BN9PR11MB5483.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