Skip to content

UefiCpuPkg/BaseRiscVMmuLib: Support MMU page unmap#12393

Open
benjamindoron wants to merge 2 commits intotianocore:masterfrom
9elements:upstream/riscv-mmu-leaf-fix
Open

UefiCpuPkg/BaseRiscVMmuLib: Support MMU page unmap#12393
benjamindoron wants to merge 2 commits intotianocore:masterfrom
9elements:upstream/riscv-mmu-leaf-fix

Conversation

@benjamindoron
Copy link
Copy Markdown
Contributor

@benjamindoron benjamindoron commented Apr 3, 2026

Description

Add support for the EFI_MEMORY_RP GCD attribute, completing the support
for the standardised page attributes and thereby allowing common code to
unmap pages.

This fixes potential security vulnerabilities, as out of bounds memory
accesses can now be caught by the MMU.

  • Breaking change?
    • Breaking change - Does this PR cause a break in build or boot behavior?
    • Examples: Does it add a new library class or move a module to a different repo.
  • Impacts security?
    • Security - Does this PR have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?
    • Tests - Does this PR include any explicit test code?
    • Examples: Unit tests or integration tests.

How This Was Tested

This was tested as part of #12314

Integration Instructions

N/A

Entries with the 'valid' bit set and RWX bits cleared are considered
"table entries" (non-leaves). With the page table in this state, future
map operations will trigger assertions when they reach the final level,
and encounter what looks like a valid non-leaf entry.

Signed-off-by: Benjamin Doron <[email protected]>
@benjamindoron benjamindoron force-pushed the upstream/riscv-mmu-leaf-fix branch from 1d967df to fe7aafc Compare April 6, 2026 15:16
Comment thread UefiCpuPkg/Library/BaseRiscVMmuLib/BaseRiscVMmuLib.c
Add support for the EFI_MEMORY_RP GCD attribute, completing the support
for the standardised page attributes and thereby allowing common code to
unmap pages.

This fixes potential security vulnerabilities, as out of bounds memory
accesses can now be caught by the MMU.

Signed-off-by: Benjamin Doron <[email protected]>
@github-actions github-actions Bot added the impact:security This change has a direct security impact such as changing a crypto algorithm. label Apr 28, 2026
@benjamindoron benjamindoron changed the title UefiCpuPkg/BaseRiscVMmuLib: Unset 'valid' when unmapping memory UefiCpuPkg/BaseRiscVMmuLib: Support MMU page unmap Apr 28, 2026
@tphan-qualcomm
Copy link
Copy Markdown
Contributor

Thanks for the patch. LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:security This change has a direct security impact such as changing a crypto algorithm.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants