Skip to content

Commit 751c263

Browse files
ardbiesheuvelwilldeacon
authored andcommitted
arm64: remove TEXT_OFFSET randomization
TEXT_OFFSET was recently changed to 0x0, in preparation for its removal at a later stage, and a warning is emitted into the kernel log when the bootloader appears to have failed to take the TEXT_OFFSET image header value into account. Ironically, this warning itself fails to take TEXT_OFFSET into account, and compares the kernel image's alignment modulo 2M against a hardcoded value of 0x0, and so the warning will trigger spuriously when TEXT_OFFSET randomization is enabled. Given the intent to get rid of TEXT_OFFSET entirely, let's fix this oversight by just removing support for TEXT_OFFSET randomization. Signed-off-by: Ard Biesheuvel <[email protected]> Acked-by: Mark Rutland <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent b3a9e3b commit 751c263

File tree

2 files changed

+0
-21
lines changed

2 files changed

+0
-21
lines changed

arch/arm64/Kconfig.debug

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,6 @@ config PID_IN_CONTEXTIDR
88
instructions during context switch. Say Y here only if you are
99
planning to use hardware trace tools with this kernel.
1010

11-
config ARM64_RANDOMIZE_TEXT_OFFSET
12-
bool "Randomize TEXT_OFFSET at build time"
13-
help
14-
Say Y here if you want the image load offset (AKA TEXT_OFFSET)
15-
of the kernel to be randomized at build-time. When selected,
16-
this option will cause TEXT_OFFSET to be randomized upon any
17-
build of the kernel, and the offset will be reflected in the
18-
text_offset field of the resulting Image. This can be used to
19-
fuzz-test bootloaders which respect text_offset.
20-
21-
This option is intended for bootloader and/or kernel testing
22-
only. Bootloaders must make no assumptions regarding the value
23-
of TEXT_OFFSET and platforms must not require a specific
24-
value.
25-
2611
config DEBUG_EFI
2712
depends on EFI && DEBUG_INFO
2813
bool "UEFI debugging"

arch/arm64/Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,7 @@ endif
121121
head-y := arch/arm64/kernel/head.o
122122

123123
# The byte offset of the kernel image in RAM from the start of RAM.
124-
ifeq ($(CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET), y)
125-
TEXT_OFFSET := $(shell awk "BEGIN {srand(); printf \"0x%06x\n\", \
126-
int(2 * 1024 * 1024 / (2 ^ $(CONFIG_ARM64_PAGE_SHIFT)) * \
127-
rand()) * (2 ^ $(CONFIG_ARM64_PAGE_SHIFT))}")
128-
else
129124
TEXT_OFFSET := 0x0
130-
endif
131125

132126
ifeq ($(CONFIG_KASAN_SW_TAGS), y)
133127
KASAN_SHADOW_SCALE_SHIFT := 4

0 commit comments

Comments
 (0)