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

From: Nathan Chancellor
Date: Fri Dec 01 2023 - 11:16:15 EST


On Thu, Nov 30, 2023 at 08:34:28PM +0100, Borislav Petkov wrote:
> On Thu, Nov 30, 2023 at 11:10:51AM -0700, Nathan Chancellor wrote:
> > I know Peter pointed out that there is a runtime switch for this, which
> > should make this patch obsolete but in case there is more reasons needed
> > for why this might be a bad idea,
>
> Bad idea? Why?
>
> Because they'd have EXPERT enabled and thus disable KASLR by accident
> this way?

Right, this is the diff of Fedora's configuration before and after this
change:

diff --git a/.config.old b/.config
index d5fe0c930725..d409b1738c0f 100644
--- a/.config.old
+++ b/.config
@@ -520,12 +520,8 @@ CONFIG_ARCH_SUPPORTS_CRASH_HOTPLUG=y
CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION=y
CONFIG_PHYSICAL_START=0x1000000
CONFIG_RELOCATABLE=y
-CONFIG_RANDOMIZE_BASE=y
-CONFIG_X86_NEED_RELOCS=y
CONFIG_PHYSICAL_ALIGN=0x1000000
CONFIG_DYNAMIC_MEMORY_LAYOUT=y
-CONFIG_RANDOMIZE_MEMORY=y
-CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING=0xa
CONFIG_ADDRESS_MASKING=y
CONFIG_HOTPLUG_CPU=y
# CONFIG_COMPAT_VDSO is not set