arm64: efi: use effective text offset when allocating Image

Update the image allocation logic in the EFI stub so that the effective
text offset is always honoured on 4 KB pagesize kernels. This ensures
that the __init segment can be mapped without resorting to early RWX

Note that this sacrifices 5 bits of KASLR randomization on such kernels.

Signed-off-by: Ard Biesheuvel <>
4 files changed