]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
UefiCpuPkg/PiSmmCpuDxeSmm: Implement NULL pointer detection for SMM code
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / Ia32 / PageTbl.c
index f295c2ebf228b6220a4ab8c97f035f9713fdb873..641a1d69a238f563eccb7f77e2f2869ef7e0d05b 100644 (file)
@@ -155,6 +155,18 @@ SmiPFHandler (
     }\r
   }\r
 \r
+  //\r
+  // If NULL pointer was just accessed\r
+  //\r
+  if ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & BIT1) != 0 &&\r
+      (PFAddress < EFI_PAGE_SIZE)) {\r
+    DEBUG ((DEBUG_ERROR, "!!! NULL pointer access !!!\n"));\r
+    DEBUG_CODE (\r
+      DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextIa32->Eip);\r
+    );\r
+    CpuDeadLoop ();\r
+  }\r
+\r
   if (FeaturePcdGet (PcdCpuSmmProfileEnable)) {\r
     SmmProfilePFHandler (\r
       SystemContext.SystemContextIa32->Eip,\r