mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/DxeIpl: Enable paging for heap guard
Heap guard feature needs paging to work properly. 64-bit BIOS uses PcdDxeIplBuildPageTables to control the page table setup. 32-bit BIOS has to check heap guard feature to decide enabling paging or not. Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
105d0c1f9d
commit
99cc7b9507
|
@ -116,6 +116,7 @@
|
|||
gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable ## SOMETIMES_CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask ## CONSUMES
|
||||
|
||||
[Pcd.IA32,Pcd.X64,Pcd.ARM,Pcd.AARCH64]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIMES_CONSUMES
|
||||
|
|
|
@ -211,6 +211,37 @@ IsExecuteDisableBitAvailable (
|
|||
return Available;
|
||||
}
|
||||
|
||||
/**
|
||||
The function will check if page table should be setup or not.
|
||||
|
||||
@retval TRUE Page table should be created.
|
||||
@retval FALSE Page table should not be created.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
ToBuildPageTable (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
if (!IsIa32PaeSupport ()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (IsNullDetectionEnabled ()) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (PcdGet8 (PcdHeapGuardPropertyMask) != 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (PcdGetBool (PcdSetNxForStack) && IsExecuteDisableBitAvailable ()) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Transfers control to DxeCore.
|
||||
|
||||
|
@ -385,10 +416,7 @@ HandOffToDxeCore (
|
|||
TopOfStack = (EFI_PHYSICAL_ADDRESS) (UINTN) ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
|
||||
|
||||
PageTables = 0;
|
||||
BuildPageTablesIa32Pae = (BOOLEAN) (IsIa32PaeSupport () &&
|
||||
(IsNullDetectionEnabled () ||
|
||||
(PcdGetBool (PcdSetNxForStack) &&
|
||||
IsExecuteDisableBitAvailable ())));
|
||||
BuildPageTablesIa32Pae = ToBuildPageTable ();
|
||||
if (BuildPageTablesIa32Pae) {
|
||||
PageTables = Create4GPageTablesIa32Pae (BaseOfStack, STACK_SIZE);
|
||||
if (IsExecuteDisableBitAvailable ()) {
|
||||
|
|
Loading…
Reference in New Issue