From: Ard Biesheuvel Date: Mon, 7 Jan 2019 06:56:49 +0000 (+0100) Subject: ArmPkg/ArmMmuLib ARM: disregard high memory when setting permissions X-Git-Tag: edk2-stable201903~364 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=d08575759e5a853e157e6e418e9fea5d5864f725 ArmPkg/ArmMmuLib ARM: disregard high memory when setting permissions Ignore calls to ArmSetMemoryAttributes () when the region described is outside of the 32-bit addressable range. This memory is not mapped in the first place, and the current code does not deal with the high bits correctly, resulting in hangs. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c index 3b3b20aa9b..bffab83d4f 100644 --- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c @@ -744,6 +744,10 @@ ArmSetMemoryAttributes ( UINT64 ChunkLength; BOOLEAN FlushTlbs; + if (BaseAddress > (UINT64)MAX_ADDRESS - Length + 1) { + return EFI_UNSUPPORTED; + } + if (Length == 0) { return EFI_SUCCESS; }