public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v1 0/1] Fix Memory Bin Range Calculation to Account for Guard Page
@ 2023-08-10 18:06 Taylor Beebe
  2023-08-10 18:06 ` [edk2-devel] [PATCH v1 1/1] MdeModulePkg: Memory Bin Range Update Accounts " Taylor Beebe
  0 siblings, 1 reply; 4+ messages in thread
From: Taylor Beebe @ 2023-08-10 18:06 UTC (permalink / raw)
  To: devel; +Cc: Jian J Wang, Liming Gao, Dandan Bi

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/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-18 21:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-10 18:06 [edk2-devel] [PATCH v1 0/1] Fix Memory Bin Range Calculation to Account for Guard Page Taylor Beebe
2023-08-10 18:06 ` [edk2-devel] [PATCH v1 1/1] MdeModulePkg: Memory Bin Range Update Accounts " Taylor Beebe
2023-08-16  1:01   ` [edk2-devel] 回复: " gaoliming via groups.io
2023-09-18 21:25   ` [edk2-devel] " Michael Kubacki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox