]> git.proxmox.com Git - mirror_edk2.git/commit - MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
MdeModulePkg/Core: Fix feature conflict between NX and Stack guard
authorHao Wu <hao.a.wu@intel.com>
Tue, 6 Mar 2018 11:34:38 +0000 (19:34 +0800)
committerHao Wu <hao.a.wu@intel.com>
Wed, 7 Mar 2018 12:56:42 +0000 (20:56 +0800)
commit7db1458f759c2e22ebb4c66bc61aa5dbae1e5fa1
treedb246075f83c6185f533b126eff4a0b407ba9fee
parenta10acf0e207ed49cb3bcce14f3de172605df6ce7
MdeModulePkg/Core: Fix feature conflict between NX and Stack guard

If enabled, NX memory protection feature will mark some types of active
memory as NX (non-executable), which includes the first page of the stack.
This will overwrite the attributes of the first page of the stack if the
stack guard feature is also enabled.

The solution is to override the attributes setting to the first page of
the stack by adding back the 'EFI_MEMORY_RP' attribute when the stack
guard feature is enabled.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
MdeModulePkg/Core/Dxe/DxeMain.inf
MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c