There is a concern case that stack and a proteced DXE memory range is in the same 2M Page Table entry, and somehow CPU doesn't flash the page table entry cache for stack, and causes Page fault when using stack. Always split the page table entry to 4K if it covers stack to avoid this issue.
Cc: Guo Dong <guo.d...@intel.com> Cc: Ray Ni <ray...@intel.com> Cc: Maurice Ma <maurice...@intel.com> Cc: Benjamin You <benjamin....@intel.com> Cc: Sean Rhodes <sean@starlabs.systems> Signed-off-by: Zhiguang Liu <zhiguang....@intel.com> --- UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c b/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c index ac0d58e685..74b667a62a 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c +++ b/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c @@ -218,16 +218,8 @@ ToSplitPageTable ( return TRUE; } - if (PcdGetBool (PcdCpuStackGuard)) { - if ((StackBase >= Address) && (StackBase < (Address + Size))) { - return TRUE; - } - } - - if (PcdGetBool (PcdSetNxForStack)) { - if ((Address < StackBase + StackSize) && ((Address + Size) > StackBase)) { - return TRUE; - } + if ((Address < StackBase + StackSize) && ((Address + Size) > StackBase)) { + return TRUE; } if (GhcbBase != 0) { -- 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#90099): https://edk2.groups.io/g/devel/message/90099 Mute This Topic: https://groups.io/mt/91446026/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-