ArmPkg/ArmMmuLib ARM: disregard high memory when setting permissions
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 7 Jan 2019 06:56:49 +0000 (07:56 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 14 Jan 2019 18:42:23 +0000 (19:42 +0100)
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 <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c

index 3b3b20a..bffab83 100644 (file)
@@ -744,6 +744,10 @@ ArmSetMemoryAttributes (
   UINT64        ChunkLength;\r
   BOOLEAN       FlushTlbs;\r
 \r
+  if (BaseAddress > (UINT64)MAX_ADDRESS - Length + 1) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
   if (Length == 0) {\r
     return EFI_SUCCESS;\r
   }\r