Skip to content

[REBASE & FF] Fix Memory Tests to Run on Patina#825

Open
os-d wants to merge 7 commits intomicrosoft:release/202502from
os-d:mem_tests_patina
Open

[REBASE & FF] Fix Memory Tests to Run on Patina#825
os-d wants to merge 7 commits intomicrosoft:release/202502from
os-d:mem_tests_patina

Conversation

@os-d
Copy link
Contributor

@os-d os-d commented Feb 6, 2026

Description

See individual commit descriptions for full details. This changeset updates the paging audit simple test, full audit, and memory protections test app to run on Patina.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

Tested on physical Intel, Q35, and SBSA.

Integration Instructions

Ensure the platform is producing the memory protection HOB with:

DxeSettings.HeapGuardPolicy.Fields.UefiPageGuard = 0;
DxeSettings.HeapGuardPolicy.Fields.UefiPoolGuard = 0;

Until Patina enables those features, otherwise those tests will execute and will fail due to no guard pages enabled.

@mu-automation mu-automation bot added language:python Pull requests that update Python code impact:testing Affects testing impact:non-functional Does not have a functional impact labels Feb 6, 2026
@os-d os-d force-pushed the mem_tests_patina branch from df67dcc to b33c49b Compare February 6, 2026 21:45
os-d added 7 commits February 6, 2026 13:53
The Paging Audit has a bad call pattern for GetMemoryMap():
it assumes that the unmerged memory map size is within 20%
larger than the merged memory map size (i.e. the first call
to GetMemoryMap() with size 0 and the subsequent call).

Instead, always use the unmerged size + 20% as the safe size
to use. Otherwise we can fail because we say we have too small
a buffer.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
This adds support for running the paging audit on X64
Patina systems. The only change required is adding
self map parsing instead of physical page table map
parsing.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
There was a flawed test in the paging audit that tried to confirm
that memory outside of the EFI_MEMORY_MAP was marked as RP, but it
did not have all the information needed to determine this. The test
was removed from the simplified tests in the test app in
microsoft@5beccf1
but it was not removed from the full paging audit. This
removes the test from the full audit.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
The Paging Audit Python script has a bad assumption
that the only RO Data should be the GDT/IDT. However,
this is incorrect for Patina, it marks any image section
that is not marked writeable as RO, so we will end up
with RO Data sections. This commit correctly reports
that instead of specifying an error.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
The DxeMemoryProtectionTestApp relies on a Project Mu produced
protocol to search images. However, this is not required for
Patina and the debug image info table can be used instead.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
This adds self mapped page table walking to the AARCH64 paging audit
test app.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
This commit adds self map page table walking for X64 in the
simple paging audit test case. The logic was copied from
CpuPageTableLib and self map logic added.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
@os-d os-d force-pushed the mem_tests_patina branch from b33c49b to 9d41c37 Compare February 6, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:non-functional Does not have a functional impact impact:testing Affects testing language:python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants