From: sashiko-bot@kernel.org
To: "Ard Biesheuvel" <ardb+git@google.com>, linux-efi@vger.kernel.org
Cc: "Ard Biesheuvel" <ardb@kernel.org>,
"Jason Gunthorpe" <jgg@nvidia.com>,
"Paul Walmsley" <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Huacai Chen" <chenhuacai@kernel.org>
Subject: Re: [PATCH v3 07/15] efi/libstub: Pass kernel entrypoint down to efi_enter_kernel()
Date: Mon, 16 Nov 2026 14:39:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-217184@kernel.org> (raw)
In-Reply-To: <20261116142618.1687025-24-ardb+git@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] efi/libstub: bogus efistub_kernel_base() address on 32-bit ARM
--
commit 452448a07bb84c8f25cb8af4964ea6a4db8f2543
Author: Ard Biesheuvel <ardb@kernel.org>
efi/libstub: Pass kernel entrypoint down to efi_enter_kernel()
This commit passes struct efi_image_info down to efi_boot_kernel() and
efi_enter_kernel() so that the kernel entrypoint is obtained from
image_info rather than calculated from linker symbols.
> diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
> index 9f406e9c0ea6f..a7f58dfe41bc3 100644
> --- a/arch/arm/boot/compressed/head.S
> +++ b/arch/arm/boot/compressed/head.S
> @@ -1450,7 +1450,7 @@ __enter_kernel_from_hyp:
> b __enter_kernel
>
> ENTRY(efi_enter_kernel)
> - mov r4, r0 @ preserve image base
> + ldr r4, [r0] @ preserve image base
> mov r8, r1 @ preserve DT pointer
>
> adr_l r0, call_cache_fn
> diff --git a/drivers/firmware/efi/libstub/arm32-stub.c b/drivers/firmware/efi/libstub/arm32-stub.c
> index f7151a4915ba2..b73a0b4fcd101 100644
> --- a/drivers/firmware/efi/libstub/arm32-stub.c
> +++ b/drivers/firmware/efi/libstub/arm32-stub.c
> @@ -127,7 +127,7 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
> efi_bs_call(free_pages, *reserve_addr + MAX_UNCOMP_KERNEL_SIZE,
> (alloc_size - MAX_UNCOMP_KERNEL_SIZE) / EFI_PAGE_SIZE);
>
> - *image_addr = kernel_base + TEXT_OFFSET;
> + *image_addr = efistub_image_info._text_offset = kernel_base + TEXT_OFFSET;
> *image_size = 0;
>
> efi_debug("image addr == 0x%lx, reserve_addr == 0x%lx\n",
[Severity: High]
Does storing the absolute address in efistub_image_info._text_offset break
efistub_kernel_base() on 32-bit ARM?
Before efi_enter_kernel() runs, efi_stub_common() derives image_addr via
efistub_kernel_base(image_info) and passes it to
efi_get_max_initrd_addr(image_addr):
drivers/firmware/efi/libstub/efistub.h:efistub_kernel_base() {
return (unsigned long)offset_to_ptr(&image_info->_text_offset);
}
drivers/firmware/efi/libstub/efi-stub.c:efi_stub_common() {
unsigned long image_addr = efistub_kernel_base(image_info);
...
efi_load_initrd(image, ULONG_MAX, efi_get_max_initrd_addr(image_addr),
NULL);
Because offset_to_ptr() adds &image_info->_text_offset to the value stored
in _text_offset, image_addr becomes the sum of two physical addresses.
That corrupts the initrd allocation limit (round_down(image_addr, SZ_4M) +
SZ_512M), either wrapping the 32-bit limit below DRAM so efi_load_initrd()
fails, or shifting it past the 512 MiB lowmem window.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116142618.1687025-17-ardb+git@google.com?part=7
next prev parent reply other threads:[~2026-11-16 14:39 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 14:26 [PATCH v3 00/15] efi: Expose loaded image properties via info struct Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 14:26 ` [PATCH v3 01/15] efi/zboot: arm64: Add missing barrier after cache maintenance Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 14:33 ` sashiko-bot
2026-11-16 14:26 ` [PATCH v3 02/15] riscv: Use _stext not _text to denote the start of kernel code Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 14:26 ` [PATCH v3 03/15] riscv: Make _text point to the start of the kernel image Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 14:26 ` [PATCH v3 04/15] efi/riscv: Rename __init_text_end to __inittext_end like other archs Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 14:26 ` [PATCH v3 05/15] efi/libstub: Avoid _end section marker in library code Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 14:26 ` [PATCH v3 06/15] efi/libstub: Capture loaded image information in struct efi_image_info Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 14:59 ` sashiko-bot
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 14:26 ` [PATCH v3 07/15] efi/libstub: Pass kernel entrypoint down to efi_enter_kernel() Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 14:39 ` sashiko-bot [this message]
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 19:31 ` Ard Biesheuvel
2026-11-16 19:31 ` Ard Biesheuvel
2026-11-16 14:26 ` [PATCH v3 08/15] efi/libstub: arm64: Use struct efi_image_info to access image properties Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 19:33 ` Ard Biesheuvel
2026-11-16 19:33 ` Ard Biesheuvel
2026-11-16 14:26 ` [PATCH v3 09/15] efi/libstub: loongarch: " Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 14:40 ` sashiko-bot
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 14:26 ` [PATCH v3 10/15] efi/libstub: riscv: " Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 14:26 ` [PATCH v3 11/15] efi/libstub: Make efi_remap_image() return efi_status_t Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 14:26 ` [PATCH v3 12/15] efi/zboot: Disentangle efi_remap_image() from efi_cache_sync_image() Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 14:52 ` sashiko-bot
2026-11-16 14:26 ` [PATCH v3 13/15] efi/libstub: arm64: Drop zboot code_size hack Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 14:26 ` [PATCH v3 14/15] efi: Make config table based primary display handover ARM-only again Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 14:26 ` [PATCH v3 15/15] Revert "efi: earlycon: Reprobe after parsing config tables" Ard Biesheuvel
2026-11-16 14:26 ` Ard Biesheuvel
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 18:52 ` Jason Gunthorpe
2026-11-16 18:52 ` [PATCH v3 00/15] efi: Expose loaded image properties via info struct Jason Gunthorpe
2026-11-16 18:52 ` Jason Gunthorpe
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-217184@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=ardb+git@google.com \
--cc=ardb@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=jgg@nvidia.com \
--cc=linux-efi@vger.kernel.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.