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

Mark DMA memory allocations XP by default #125

Merged
merged 2 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ DmaAllocateAlignedBuffer (
Status = gDS->SetMemorySpaceAttributes (
(PHYSICAL_ADDRESS)(UINTN)Allocation,
EFI_PAGES_TO_SIZE (Pages),
MemType
MemType | EFI_MEMORY_XP // MU_CHANGE: Allocate DMA memory XP by default
);
if (EFI_ERROR (Status)) {
goto FreeAlloc;
Expand Down
3 changes: 3 additions & 0 deletions PrmPkg/PrmConfigDxe/PrmConfigDxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ SetRuntimeMemoryRangeAttributes (
(UINT64)RuntimeMmioRanges->Range[Index].Length,
// MU_CHANGE START: The memory space descriptor access attributes are not accurate. Don't pass
// in access attributes so SetMemorySpaceAttributes() doesn't update them.
// EFI_MEMORY_RUNTIME is not a CPU arch attribute, so calling
// SetMemorySpaceAttributes() with only it set will not clear existing page table
// attributes for this region, such as EFI_MEMORY_XP
// Descriptor.Attributes | EFI_MEMORY_RUNTIME
EFI_MEMORY_RUNTIME
// MU_CHANGE END
Expand Down