aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/Makefile
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2020-04-15 10:29:22 +0200
committerWill Deacon <will@kernel.org>2020-04-28 14:38:57 +0100
commitcfa7ede20f133cc81cef01dc3a516dda3a9721ee (patch)
tree01629dfb98c6e9077157494d82e91e8ae5a82fab /arch/arm64/Makefile
parentarm64: lib: Consistently enable crc32 extension (diff)
downloadlinux-dev-cfa7ede20f133cc81cef01dc3a516dda3a9721ee.tar.xz
linux-dev-cfa7ede20f133cc81cef01dc3a516dda3a9721ee.zip
arm64: set TEXT_OFFSET to 0x0 in preparation for removing it entirely
TEXT_OFFSET on arm64 is a historical artifact from the early days of the arm64 port where the boot protocol was basically 'copy this image to the base of memory + 512k', giving us 512 KB of guaranteed BSS space to put the swapper page tables. When the arm64 Image header was added in v3.10, it already carried the actual value of TEXT_OFFSET, to allow the bootloader to discover it dynamically rather than hardcode it to 512 KB. Today, this memory window is not used for any particular purpose, and it is simply handed to the page allocator at boot. The only reason it still exists is because of the 512k misalignment it causes with respect to the 2 MB aligned virtual base address of the kernel, which affects the virtual addresses of all statically allocated objects in the kernel image. However, with the introduction of KASLR in v4.6, we added the concept of relocatable kernels, which rewrite all absolute symbol references at boot anyway, and so the placement of such kernels in the physical address space is irrelevant, provided that the minimum segment alignment is honoured (64 KB in most cases, 128 KB for 64k pages kernels with vmap'ed stacks enabled). This makes 0x0 and 512 KB equally suitable values for TEXT_OFFSET on the off chance that we are dealing with boot loaders that ignore the value passed via the header entirely. Considering that the distros as well as Android ship KASLR-capable kernels today, and the fact that TEXT_OFFSET was discoverable from the Image header from the very beginning, let's change this value to 0x0, in preparation for removing it entirely at a later date. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20200415082922.32709-1-ardb@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch/arm64/Makefile')
-rw-r--r--arch/arm64/Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 5861cb0f48fd..e48867c335d2 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -117,7 +117,7 @@ TEXT_OFFSET := $(shell awk "BEGIN {srand(); printf \"0x%06x\n\", \
int(2 * 1024 * 1024 / (2 ^ $(CONFIG_ARM64_PAGE_SHIFT)) * \
rand()) * (2 ^ $(CONFIG_ARM64_PAGE_SHIFT))}")
else
-TEXT_OFFSET := 0x00080000
+TEXT_OFFSET := 0x0
endif
ifeq ($(CONFIG_KASAN_SW_TAGS), y)