mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
EmbeddedPkg: Mark DMA Memory Allocations XP By Default
When allocating memory for a non-coherent DMA device, the current core code removes the XP attribute, allowing code to execute from that region. This is a security vulnerability and unneeded. This change updates to mark the region as XP when allocating memory for the non-coherent DMA device. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
This commit is contained in:
parent
469f29fe76
commit
8984fba2f2
@ -553,11 +553,11 @@ DmaAllocateAlignedBuffer (
|
||||
|
||||
InsertHeadList (&UncachedAllocationList, &Alloc->Link);
|
||||
|
||||
// Remap the region with the new attributes
|
||||
// Remap the region with the new attributes and mark it non-executable
|
||||
Status = gDS->SetMemorySpaceAttributes (
|
||||
(PHYSICAL_ADDRESS)(UINTN)Allocation,
|
||||
EFI_PAGES_TO_SIZE (Pages),
|
||||
MemType
|
||||
MemType | EFI_MEMORY_XP
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto FreeAlloc;
|
||||
|
Loading…
x
Reference in New Issue
Block a user