Hi Sean,

 

The patch set is a code refactoring and doesn't change any functionality.  The reason for this code refactoring is because:

1. In PiSmmCpuDxe driver entrypoint, this driver initializes smm page table which is different from Cr3 register. Currently, mInternalCr3 is used to pass address of page table which is different from Cr3 register.

     Now remove it and pass the page table base address from the root function to simplify the code logic.

2. Besides, current code logic will regard a RO range as shadow stack and set the dirty bit in corresponding page table entry if mInternalCr3 is not 0. This assumption may be confusing.

    A new mIsShadowStack flag will be created to identify if it is a shadow stack  or not.

 

Thanks,

Dun

From: Sean Brogan <spbrogan@outlook.com>
Sent: Wednesday, August 10, 2022 11:21 AM
To: devel@edk2.groups.io; Tan, Dun <dun.tan@intel.com>
Subject: Re: [edk2-devel] [PATCH 0/2] Remove mInternalCr3 in PiSmmCpuDxeSmm

 

Is there any documentation to why this change is important and what exactly was broken?

 

Thanks

Sean


From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of duntan <dun.tan@intel.com>
Sent: Tuesday, August 9, 2022 6:45:30 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Subject: [edk2-devel] [PATCH 0/2] Remove mInternalCr3 in PiSmmCpuDxeSmm

 

Add a new IsShadowStack flag in PiSmmCpuDxeSmm.
Remove mInternalCr3 in PiSmmCpuDxeSmm.

Dun Tan (2):
  UefiCpuPkg/PiSmmCpuDxeSmm: Add a new IsShadowStack flag
  UefiCpuPkg/PiSmmCpuDxeSmm: Remove mInternalCr3 in PiSmmCpuDxeSmm

 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c           |  30 +++++-------------------------
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h         |  26 +++++++++-----------------
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c            |  73 +++++++++++++++++++++++--------------------------------------------------
 4 files changed, 98 insertions(+), 144 deletions(-)

--
2.31.1.windows.1