public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Borislav Petkov <bp@alien8.de>
Cc: X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] x86/Kconfig: Disable KASLR on debug builds
Date: Thu, 30 Nov 2023 11:10:51 -0700	[thread overview]
Message-ID: <20231130181051.GA3357088@dev-arch.thelio-3990X> (raw)
In-Reply-To: <20231130120552.6735-1-bp@alien8.de>

On Thu, Nov 30, 2023 at 01:05:52PM +0100, Borislav Petkov wrote:
> 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>

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, most distribution configurations have
CONFIG_DEBUG_KERNEL enabled because CONFIG_EXPERT selects it:

archlinux/x86_64.config:CONFIG_DEBUG_KERNEL=y
debian/amd64.config:CONFIG_DEBUG_KERNEL=y
fedora/x86_64.config:CONFIG_DEBUG_KERNEL=y
opensuse/x86_64.config:CONFIG_DEBUG_KERNEL=y

> ---
>  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
> 

  parent reply	other threads:[~2023-11-30 18:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30 12:05 [RFC PATCH] x86/Kconfig: Disable KASLR on debug builds Borislav Petkov
2023-11-30 12:08 ` Peter Zijlstra
2023-11-30 12:49   ` Borislav Petkov
2023-12-04 10:42     ` Mark Rutland
2023-12-04 15:49       ` Borislav Petkov
2023-12-04 17:20         ` Mark Rutland
2023-11-30 18:10 ` Nathan Chancellor [this message]
2023-11-30 19:34   ` Borislav Petkov
2023-12-01 16:16     ` Nathan Chancellor
2023-12-01 16:24       ` Borislav Petkov
2023-12-01 16:58         ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231130181051.GA3357088@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox