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 <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
Ard Biesheuvel 2019-01-07 07:56:49 +01:00
parent e695e44545
commit d08575759e
1 changed files with 4 additions and 0 deletions

View File

@ -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;
}