ArmPkg/CpuDxe: ignore attribute changes during SyncCacheConfig()
To prevent the initial MMU->GCD memory space map synchronization from stripping permissions attributes [which we cannot use in the GCD memory space map, unfortunately], implement the same approach as x86, and ignore SetMemoryAttributes() calls during the time SyncCacheConfig() is in progress. This is a horrible hack, but is currently the only way we can implement strict permissions on arbitrary memory regions [as opposed to PE/COFF text/data sections only] Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
@@ -188,6 +188,10 @@ CpuSetMemoryAttributes (
|
||||
UINTN RegionLength;
|
||||
UINTN RegionArmAttributes;
|
||||
|
||||
if (mIsFlushingGCD) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if ((BaseAddress & (SIZE_4KB - 1)) != 0) {
|
||||
// Minimum granularity is SIZE_4KB (4KB on ARM)
|
||||
DEBUG ((EFI_D_PAGE, "CpuSetMemoryAttributes(%lx, %lx, %lx): Minimum ganularity is SIZE_4KB\n", BaseAddress, Length, EfiAttributes));
|
||||
|
Reference in New Issue
Block a user