[RFC PATCH] x86/Kconfig: Disable KASLR on debug builds

Borislav Petkov
2023-11-30T12:06:19Z

From: "Borislav Petkov (AMD)" <bp@alien8.de>

Having KASLR enabled makes debugging a kernel completely useless because
virtual addresses are not stable, leading to people poking at kernel
internals to have to go and rebuild with RANDOMIZE_BASE=off.

Just disable it on debugging builds where it is not needed anyway.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
---
arch/x86/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index c456c9b1fc7c..da94354b1b75 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2159,7 +2159,7 @@ config RELOCATABLE

config RANDOMIZE_BASE
bool "Randomize the address of the kernel image (KASLR)"
- depends on RELOCATABLE
+ depends on RELOCATABLE && !DEBUG_KERNEL
default y
help
In support of Kernel Address Space Layout Randomization (KASLR),
--
2.42.0.rc0.25.ga82fb66fed25