audk/MdeModulePkg/Core/Dxe
Jian J Wang 425d25699b MdeModulePkg/Core: fix a logic hole in page free
This hole will cause page fault randomly. The root cause is that Guard
page, which is just freed back to page pool but not yet cleared not-
present attribute, will be allocated right away by internal function
CoreFreeMemoryMapStack(). The solution to this issue is to clear the
not-present attribute for freed Guard page before doing any free
operation, instead of after those operation.

The reason we didn't do this before is due to the fact that manipulating
page attributes might cause memory allocation action which would cause a
dead lock inside a memory allocation/free operation. So we always set or
unset Guard page outside the memory lock. After a thorough analysis, we
believe clearing a Guard page will not cause memory allocation because
memory we're to manipulate was already manipulated before for sure.
Therefore there should be no memory allocation occurring in this
situation.

Since we cleared Guard page not-present attribute before freeing instead
of after freeing, the debug code to clear freed memory can now be restored
to its original way (aka no checking and bypassing Guard page).

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Star Zeng <star.zeng@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>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2018-01-19 14:16:11 +08:00
..
Dispatcher MdeModulePkg DxeCore: Support USED_SIZE FV_EXT_TYPE 2017-12-01 09:36:59 +08:00
DxeMain MdeModulePkg/Core/Dxe: Call new API InitializeCpuExceptionHandlersEx instead 2017-12-08 14:38:51 +08:00
Event MdeModulePkg/Tpl: Fix negative value left shift 2017-09-29 16:14:17 +08:00
FwVol MdeModulePkg Core: Propagate PEI-phase FV authentication status to DXE 2017-10-10 20:54:42 +08:00
FwVolBlock MdeModulePkg Core: Propagate PEI-phase FV authentication status to DXE 2017-10-10 20:54:42 +08:00
Gcd MdeModulePkg: Update DxeCore to consume PI EfiGcdMemoryTypePersistent 2017-10-10 14:19:18 +08:00
Hand MdeModulePkg/DxeCore: Add comments for the ASSERT to check NULL ptr 2017-10-09 10:45:31 +08:00
Image MdeModulePkg/Core/Dxe: Remove extra connects for UEFI Applications 2017-11-13 09:56:49 -08:00
Library Update the copyright notice format 2010-04-24 09:49:11 +00:00
Mem MdeModulePkg/Core: fix a logic hole in page free 2018-01-19 14:16:11 +08:00
Misc MdeModulePkg/Core: Fix heap guard issues 2017-12-26 18:07:27 +08:00
SectionExtraction MdeModulePkg DxeCore: Only free ScratchBuffer when it is not NULL 2017-06-26 13:17:16 +08:00
DxeCore.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DxeCoreExtra.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DxeMain.h MdeModulePkg/Core: Merge memory map after filtering paging capability 2017-11-28 09:25:32 +08:00
DxeMain.inf MdeModulePkg/Core: Add missing header files into inf 2017-11-24 08:35:29 +08:00