linux/arch/arm64
Ard Biesheuvel 4190312beb arm64: align randomized TEXT_OFFSET on 4 kB boundary
When booting via UEFI, the kernel Image is loaded at a 4 kB boundary and
the embedded EFI stub is executed in place. The EFI stub relocates the
Image to reside TEXT_OFFSET bytes above a 2 MB boundary, and jumps into
the kernel proper.

In AArch64, PC relative symbol references are emitted using adrp/add or
adrp/ldr pairs, where the offset into a 4 kB page is resolved using a
separate :lo12: relocation. This implicitly assumes that the code will
always be executed at the same relative offset with respect to a 4 kB
boundary, or the references will point to the wrong address.

This means we should link the kernel at a 4 kB aligned base address in
order to remain compatible with the base address the UEFI loader uses
when doing the initial load of Image. So update the code that generates
TEXT_OFFSET to choose a multiple of 4 kB.

At the same time, update the code so it chooses from the interval [0..2MB)
as the author originally intended.

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2014-08-19 19:26:09 +01:00
..
boot dts: Add bindings for APM X-Gene SoC ethernet driver 2014-08-11 11:50:33 -07:00
configs arm64: defconfig: enable devtmpfs mount option 2014-07-30 16:54:21 +01:00
crypto arm64 updates for 3.17 2014-08-04 12:31:53 -07:00
include arm64: compat: wire up memfd_create and getrandom syscalls for aarch32 2014-08-18 19:47:04 +01:00
kernel arm64: align randomized TEXT_OFFSET on 4 kB boundary 2014-08-19 19:26:09 +01:00
kvm arm64: KVM: fix 64bit CP15 VM access for 32bit guests 2014-08-01 14:05:06 +02:00
lib arm64: lib: Implement optimized string length routines 2014-05-23 15:17:12 +01:00
mm arm64 updates for 3.17 2014-08-04 12:31:53 -07:00
xen arm: xen: implement multicall hypercall support. 2014-04-24 13:09:46 +01:00
Kconfig lib/scatterlist: make ARCH_HAS_SG_CHAIN an actual Kconfig 2014-08-08 15:57:26 -07:00
Kconfig.debug arm64: Enable TEXT_OFFSET fuzzing 2014-07-10 12:36:58 +01:00
Makefile arm64: align randomized TEXT_OFFSET on 4 kB boundary 2014-08-19 19:26:09 +01:00