efi/libstub/arm64: Simplify randomized loading of kernel image
authorArd Biesheuvel <ardb@kernel.org>
Mon, 13 Apr 2020 13:36:37 +0000 (15:36 +0200)
committerArd Biesheuvel <ardb@kernel.org>
Thu, 23 Apr 2020 18:15:06 +0000 (20:15 +0200)
commit5d12da9dd6c155f7a09dfcaa2b9827764c939b2a
tree4947aa3c638f2c3cd9884a8702290e6388dcfee8
parent82046702e288bdd81673b81ab5138e498d155918
efi/libstub/arm64: Simplify randomized loading of kernel image

The KASLR code path in the arm64 version of the EFI stub incorporates
some overly complicated logic to randomly allocate a region of the right
alignment: there is no need to randomize the placement of the kernel
modulo 2 MiB separately from the placement of the 2 MiB aligned allocation
itself - we can simply follow the same logic used by the non-randomized
placement, which is to allocate at the correct alignment, and only take
TEXT_OFFSET into account if it is not a round multiple of the alignment.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/libstub/arm64-stub.c