Linux EFI development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ard Biesheuvel" <ardb+git@google.com>, x86@kernel.org
Cc: linux-efi@vger.kernel.org, "Ard Biesheuvel" <ardb@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH v2] x86: Always permit the kernel to be placed at any physical address
Date: Tue, 24 Nov 2026 11:15:10 +0000	[thread overview]
Message-ID: <sashiko-outbox-231026@kernel.org> (raw)
In-Reply-To: <20261124110522.1371247-2-ardb+git@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] x86/Kconfig: config RELOCATABLE uses def_bool y instead of
  bool
--

commit c734084ffe5143387f2c8e1cef5938ed63060e83
Author: Ard Biesheuvel <ardb@kernel.org>

x86: Always permit the kernel to be placed at any physical address

This commit removes the CONFIG_RELOCATABLE gating around physical load
address handling in the x86 decompressor and boot header, and restricts
CONFIG_RELOCATABLE to 32-bit kernels and KASLR builds.

> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 15fd9ec5ecacb..5af340f77b5c6 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig

[ ... ]

> @@ -1994,66 +1994,37 @@ config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
>  	  Don't change this unless you know what you are doing.
> +	  Legacy i386 kdump use cases based on vmlinux rather than bzImage
> +	  might need to override this, otherwise leave at its default.
>  
>  config RELOCATABLE
> -	bool "Build a relocatable kernel"
> -	default y
> +	def_bool y
>  	help
> -	  This builds a kernel image that retains relocation information
> -	  so it can be loaded someplace besides the default 1MB.
> -	  The relocations tend to make the kernel binary about 10% larger,
> -	  but are discarded at runtime.
> +	  This builds a kernel image that retains relocation information,
> +	  allowing its placement in the virtual address space to deviate from
> +	  the build time default. The relocations are applied at boot and then
> +	  discarded, so their runtime memory footprint is zero.
>  
> -	  One use is for the kexec on panic case where the recovery kernel
> -	  must live at a different physical address than the primary
> -	  kernel.
> +	  On i386, the virtual displacement relative to PAGE_OFFSET must equal
> +	  the physical displacement relative to LOAD_OFFSET, and so this option
> +	  must always be set.
>  
> -	  Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address
> -	  it has been loaded at and the compile time physical address
> -	  (CONFIG_PHYSICAL_START) is used as the minimum location.
> +	  On x86_64, the virtual displacement is independent from the physical
> +	  placement, and the relocations are only used when randomizing the
> +	  virtual address space (KASLR).
>  
>  config RANDOMIZE_BASE
>  	bool "Randomize the address of the kernel image (KASLR)"
> -	depends on RELOCATABLE
> +	select RELOCATABLE
>  	default y
>  	help
>  	  In support of Kernel Address Space Layout Randomization (KASLR),
> @@ -2089,30 +2060,19 @@ config RANDOMIZE_BASE
>  # Relocation on x86 needs some additional build support
>  config X86_NEED_RELOCS
>  	def_bool y
> -	depends on RANDOMIZE_BASE || (X86_32 && RELOCATABLE)
> +	depends on RELOCATABLE
>  	select ARCH_VMLINUX_NEEDS_RELOCS

[Severity: Medium]
Should config RELOCATABLE be declared as bool rather than def_bool y?

With def_bool y, CONFIG_RELOCATABLE is unconditionally enabled even when
neither X86_32 nor RANDOMIZE_BASE selects it. Because X86_NEED_RELOCS now
depends only on RELOCATABLE, an x86_64 build with CONFIG_RANDOMIZE_BASE=n
has CONFIG_RELOCATABLE=y and CONFIG_X86_NEED_RELOCS=y forced on, still
emitting and compressing vmlinux.relocs into the image and running
handle_relocations() at boot.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124110522.1371247-2-ardb+git@google.com?part=1

      reply	other threads:[~2026-11-24 11:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 11:05 [PATCH v2] x86: Always permit the kernel to be placed at any physical address Ard Biesheuvel
2026-11-24 11:15 ` sashiko-bot [this message]

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=sashiko-outbox-231026@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ardb+git@google.com \
    --cc=ardb@kernel.org \
    --cc=hpa@zytor.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --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