summaryrefslogtreecommitdiffstats
path: root/PrmPkg
diff options
context:
space:
mode:
authorTaylor Beebe <31827475+TaylorBeebe@users.noreply.github.com>2022-11-08 11:56:07 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-07-24 21:13:52 +0000
commita96d2a8f2dd3eb7e32b383821fe30cfd7cdb2248 (patch)
tree0e457dd09c48344d7442c3549b0e2d23d4620b7f /PrmPkg
parenta7abb77c599f4243d7dbab552ec74ed4d0d0d152 (diff)
downloadedk2-a96d2a8f2dd3eb7e32b383821fe30cfd7cdb2248.tar.gz
edk2-a96d2a8f2dd3eb7e32b383821fe30cfd7cdb2248.tar.bz2
edk2-a96d2a8f2dd3eb7e32b383821fe30cfd7cdb2248.zip
PrmPkg: Don't Set Access Attributes of Runtime MMIO Ranges
Passing in access attributes to SetMemorySpaceAttributes() will cause the existing attributes to be overwritten. The MMIO region should have the appropriate attributes applied during memory protection initialization and the attributes of the memory space descriptor are inaccurate. Don't pass in any CPU arch attributes so SetMemorySpaceAttributes() doesn't subsequently call gCpu->SetMemoryAttributes(). Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
Diffstat (limited to 'PrmPkg')
-rw-r--r--PrmPkg/PrmConfigDxe/PrmConfigDxe.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/PrmPkg/PrmConfigDxe/PrmConfigDxe.c b/PrmPkg/PrmConfigDxe/PrmConfigDxe.c
index 550ee64b4c..7a3913ee09 100644
--- a/PrmPkg/PrmConfigDxe/PrmConfigDxe.c
+++ b/PrmPkg/PrmConfigDxe/PrmConfigDxe.c
@@ -152,10 +152,15 @@ SetRuntimeMemoryRangeAttributes (
continue;
}
+ // 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
Status = gDS->SetMemorySpaceAttributes (
RuntimeMmioRanges->Range[Index].PhysicalBaseAddress,
(UINT64)RuntimeMmioRanges->Range[Index].Length,
- Descriptor.Attributes | EFI_MEMORY_RUNTIME
+ EFI_MEMORY_RUNTIME
);
ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status)) {