From: Taylor Beebe <taylor.d.beebe@gmail.com>
The following flow will produce an issue:
If page guards are active for EfiReservedMemoryType and SMM NULL pointer
protection is active with nonstop mode enabled, then a large (600 page)
allocation of EfiReservedMemoryType will be made for profiling.
0. InitSmmProfile() will be called to allocate a large range of memory for
profiling.
1. gBS->AllocatePages() will be called with Type = EfiReservedMemoryType and
Pages = 600.
2. gBS->AllocatePages() will call FindFreePages() to find a range of 600 pages
in the memory map.
3. FindFreePages() will find a range and the binned address range will need to
be updated.
4. The binned address range start will be updated to include the start of the
range found by FindFreePages() but will NOT include the guard page.
5. CoreConvertPagesWithGuard() will be called to change the range type to
EfiReservedMemoryType. The function will increase the conversion range
to include the guard pages.
6. After converting the range, the CoreConvertRangeEx() logic will check
if the range is in the binned address bounds to see if it should updated
the memory type statistics.
7. The range will be outside of the binned address bounds by one page because
the guard page was not included in the binned address range causing the
large allocation to be unnacounted for in the of memory type statistics.
8. When the original bins are compared with the current bins to see if the
system should reset with a larger original bin size, the large allocation
will not be accounted for and the system will not reset with a larger bin
size which is incorrect behavior.
Cc: Taylor Beebe <t@taylorbeebe.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Taylor Beebe (1):
MdeModulePkg: Memory Bin Range Update Accounts for Guard Page
MdeModulePkg/Core/Dxe/Mem/Page.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.41.0.windows.3
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107697): https://edk2.groups.io/g/devel/message/107697
Mute This Topic: https://groups.io/mt/100668861/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-