diff options
author | Jian J Wang <devel@edk2.groups.io> | 2019-11-06 21:13:33 +0000 |
---|---|---|
committer | Jian J Wang <jian.j.wang@intel.com> | 2019-11-09 10:59:57 +0800 |
commit | fb92fe9e1817a53ca0fc985447f3c534201a62fa (patch) | |
tree | 4af71e1ff205e738a1ac830d9526294e51f9bd89 /MdeModulePkg | |
parent | f9d0e5daa058f0cf4caa8edad0dfa2a3a390f1b0 (diff) | |
download | edk2-fb92fe9e1817a53ca0fc985447f3c534201a62fa.zip edk2-fb92fe9e1817a53ca0fc985447f3c534201a62fa.tar.gz edk2-fb92fe9e1817a53ca0fc985447f3c534201a62fa.tar.bz2 |
MdeModulePkg/Core/Dxe: free page 0 after disabling NULL pointer detection
To solve access issue reported by BZ1885, page 0 will be allocated to
avoid misuses if NULL pointer detection is enabled. It should be better
to be freed after EndOfDxe if BIT7 of PcdNullPointerDetectionPropertyMask
is set, because NULL pointer detection is no longer available after
EndOfDxe and there will be no access conflict.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1885
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c index 7a24bd0..47edf86 100644 --- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c +++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c @@ -1094,6 +1094,11 @@ DisableNullDetectionAtTheEndOfDxe ( );
ASSERT_EFI_ERROR (Status);
+ //
+ // Page 0 might have be allocated to avoid misuses. Free it here anyway.
+ //
+ CoreFreePages (0, 1);
+
CoreCloseEvent (Event);
DEBUG ((DEBUG_INFO, "DisableNullDetectionAtTheEndOfDxe(): end\r\n"));
|