Please see the attached patch that guarantees that free memory in the 4K page 
starting at address 0 is always cleared to 0.  The algorithm is to clear page 
zero if it is registered with the DXE Core with type EfiConventionalMemory, and 
to also clear page zero if it is freed using the UEFI Boot Service FreePages(). 
 The unit test for this patch exposed a bug in the DXE Core that generated an 
ASSERT() when the page at address zero is freed and DEBUG_CLEAR_MEMORY() macros 
are enabled.  If DEBUG_CLEAR_MEMORY() is enabled and the page at address 0 is 
freed, then DEBUG_CLEAR_MEMORY() is invoked skipping over the first 4K page.

This patch improves OS compatibility for OSes that may evaluate page 0 for 
legacy data structures.  Before this patch, free memory may contain random 
values which induces random boot failures for some OSes.  This patch may also 
help find NULL pointer bugs sooner because all of the fields in a data 
structure dereferenced through NULL will also be NULL now.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney  
michael.d.kin...@intel.com<mailto:michael.d.kin...@intel.com>





Attachment: Page.c.patch
Description: Page.c.patch

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to