summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Core/PiSmmCore/HeapGuard.c
diff options
context:
space:
mode:
authorJian J Wang <jian.j.wang@intel.com>2018-04-11 16:35:32 +0800
committerStar Zeng <star.zeng@intel.com>2018-04-13 13:04:59 +0800
commit5fef2c7069a846754dda2f6416b11d5554f05ac3 (patch)
tree61114d43041fc83ee06d0e1f060495b80f650b94 /MdeModulePkg/Core/PiSmmCore/HeapGuard.c
parenta5cd613cdbf1edef1a98536fb2723b5d88bd53cd (diff)
downloadedk2-5fef2c7069a846754dda2f6416b11d5554f05ac3.tar.gz
edk2-5fef2c7069a846754dda2f6416b11d5554f05ac3.tar.bz2
edk2-5fef2c7069a846754dda2f6416b11d5554f05ac3.zip
MdeModulePkg/SmmCore: add sanity check for SetMemoryAttributes
Heap Guard feature needs enough memory and paging to work. Otherwise calling SetMemoryAttributes to change page attribute will fail. This patch add necessary check of result of calling SetMemoryAttributes. This can help users to debug their problem in enabling this feature. Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
Diffstat (limited to 'MdeModulePkg/Core/PiSmmCore/HeapGuard.c')
-rw-r--r--MdeModulePkg/Core/PiSmmCore/HeapGuard.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c b/MdeModulePkg/Core/PiSmmCore/HeapGuard.c
index d5556eb79c..d9e54b96cb 100644
--- a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c
+++ b/MdeModulePkg/Core/PiSmmCore/HeapGuard.c
@@ -592,14 +592,17 @@ SetGuardPage (
IN EFI_PHYSICAL_ADDRESS BaseAddress
)
{
+ EFI_STATUS Status;
+
if (mSmmMemoryAttribute != NULL) {
mOnGuarding = TRUE;
- mSmmMemoryAttribute->SetMemoryAttributes (
- mSmmMemoryAttribute,
- BaseAddress,
- EFI_PAGE_SIZE,
- EFI_MEMORY_RP
- );
+ Status = mSmmMemoryAttribute->SetMemoryAttributes (
+ mSmmMemoryAttribute,
+ BaseAddress,
+ EFI_PAGE_SIZE,
+ EFI_MEMORY_RP
+ );
+ ASSERT_EFI_ERROR (Status);
mOnGuarding = FALSE;
}
}
@@ -619,14 +622,17 @@ UnsetGuardPage (
IN EFI_PHYSICAL_ADDRESS BaseAddress
)
{
+ EFI_STATUS Status;
+
if (mSmmMemoryAttribute != NULL) {
mOnGuarding = TRUE;
- mSmmMemoryAttribute->ClearMemoryAttributes (
- mSmmMemoryAttribute,
- BaseAddress,
- EFI_PAGE_SIZE,
- EFI_MEMORY_RP
- );
+ Status = mSmmMemoryAttribute->ClearMemoryAttributes (
+ mSmmMemoryAttribute,
+ BaseAddress,
+ EFI_PAGE_SIZE,
+ EFI_MEMORY_RP
+ );
+ ASSERT_EFI_ERROR (Status);
mOnGuarding = FALSE;
}
}