Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: 66346d5edeac2a00d3cf2f2f3b5f66d423c07b3e
      
https://github.com/tianocore/edk2/commit/66346d5edeac2a00d3cf2f2f3b5f66d423c07b3e
  Author: Piotr Wejman <[email protected]>
  Date:   2025-12-30 (Tue, 30 Dec 2025)

  Changed paths:
    M MdeModulePkg/Core/Dxe/Mem/Page.c

  Log Message:
  -----------
  MdeModulePkg: Fix FreePages not existent memory

Commit 2d69507a4dde02f1abf20c7eb3a43d1d3ef6b98f added an attribute check to
prevent freeing memory that is read-only, read-protected, or for which
attribute retrieval fails. In such cases the code returned EFI_SUCCESS and
leaked the memory.

This introduced a regression in the System Architecture Compliance Suite
(ACS) BS.FreePages – Not Existent Memory test.
Link: 
https://github.com/tianocore/edk2-test/blob/edk2-test-stable202509/uefi-sct/Doc/TestCaseSpec/03_Services_Boot_Services.md#freepages
Test number: 5.1.2.2.1

GetMemoryAttributes() returns EFI_UNSUPPORTED for memory regions outside
system memory. The previous change treated all errors as a reason to leak
memory, while only the EFI_NO_MAPPING error code should trigger that
behavior. As a result, freeing non-existent memory incorrectly returned
EFI_SUCCESS instead of EFI_NOT_FOUND.

To fix this, memory is now leaked only when:
- GetMemoryAttributes() returns EFI_NO_MAPPING (inconsistent attributes),
  or
- GetMemoryAttributes() succeeds and the pages are marked RO or RP.

All other errors fall through to CoreInternalFreePages(), restoring the
previous and correct behavior.

Signed-off-by: Piotr Wejman <[email protected]>



To unsubscribe from these emails, change your notification settings at 
https://github.com/tianocore/edk2/settings/notifications


_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to