diff options
| author | Piotr Wejman <piotr.wejman@arm.com> | 2025-12-03 18:14:57 +0300 |
|---|---|---|
| committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2025-12-30 04:36:38 +0300 |
| commit | 66346d5edeac2a00d3cf2f2f3b5f66d423c07b3e (patch) | |
| tree | b45adad9016502919a10c1b532204c503e67259d /MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptInternalFormat.h | |
| parent | fe9447553858acbbf1446d3e18362c1c74cdfd93 (diff) | |
| download | edk2-66346d5edeac2a00d3cf2f2f3b5f66d423c07b3e.tar.xz | |
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 <piotr.wejman@arm.com>
Diffstat (limited to 'MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptInternalFormat.h')
0 files changed, 0 insertions, 0 deletions
