Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArmPkg: ArmMmuLib: Pre-Allocate Page Table Memory #6286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Nov 8, 2024

  1. ArmPkg: ArmMmuLib: Pre-Allocate Page Table Memory

    Allocating memory when memory protection is active can cause the below
    infinite loop:
    
    1. gCpu->SetMemoryAttributes(EFI_MEMORY_RO)
    2. ArmSetMemoryAttributes ()
    3. SetMemoryRegionAttribute()
    4. UpdateRegionMapping()
    5. UpdateRegionMappingRecursive()
    6. AllocatePages() -> Need memory for a translation table entry
    7. CoreAllocatePages()
    8. ApplyMemoryProtectionPolicy() -> Policy says new page should be XN
    9. gCpu->SetMemoryAttributes()
    10. Back to 3
    
    To fix this previously, CpuDxe would update conventional memory to be XN
    prior to installing the CpuArch protocol. However, when we transition to
    setting EFI_MEMORY_RP on free memory, this will no longer work.
    
    This PR updates ArmMmuLib to reserve page table memory for allocation
    during table spits to prevent the infinite loop.
    
    It also updates the consumers of ArmMmuLib to consume the PEI version
    of the lib in the same commit so as to not break them.
    
    Continuous-integration-options: PatchCheck.ignore-multi-package
    
    Signed-off-by: Oliver Smith-Denny <[email protected]>
    TaylorBeebe authored and os-d committed Nov 8, 2024
    Configuration menu
    Copy the full SHA
    9b75002 View commit details
    Browse the repository at this point in the history