arm64: efi: Limit allocations to 48-bit addressable physical region
authorArd Biesheuvel <ardb@kernel.org>
Mon, 5 Dec 2022 08:10:17 +0000 (09:10 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Wed, 7 Dec 2022 18:50:44 +0000 (19:50 +0100)
commita37dac5c5dcfe0f1fd58513c16cdbc280a47f628
treeecce8a5149a40a52f75d3a446877f0611faf9d0b
parentd9f26ae731259c8fb2d62a742c64e454996944a8
arm64: efi: Limit allocations to 48-bit addressable physical region

The UEFI spec does not mention or reason about the configured size of
the virtual address space at all, but it does mention that all memory
should be identity mapped using a page size of 4 KiB.

This means that a LPA2 capable system that has any system memory outside
of the 48-bit addressable physical range and follows the spec to the
letter may serve page allocation requests from regions of memory that
the kernel cannot access unless it was built with LPA2 support and
enables it at runtime.

So let's ensure that all page allocations are limited to the 48-bit
range.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
arch/arm64/include/asm/efi.h
drivers/firmware/efi/libstub/alignedmem.c
drivers/firmware/efi/libstub/arm64-stub.c
drivers/firmware/efi/libstub/efistub.h
drivers/firmware/efi/libstub/mem.c
drivers/firmware/efi/libstub/randomalloc.c