From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH master] efi: loader: require at least 128 KiB of stack space
Date: Sat, 27 Jun 2026 23:25:33 +0200 [thread overview]
Message-ID: <20260627212534.3785131-1-a.fatoum@barebox.org> (raw)
rEFInd overflows the default 32K barebox stack when it is loaded as
a second EFI payload after GRUB from the NixOS arm64 ISO.
UEFI requires at least 128K of stack space for calls into EFI
applications. Have STACK_SIZE default to 128 KiB and enforce that it
doesn't get smaller than that whenever EFI_LOADER is enabled.
Non-EFI builds are unaffected.
This aligns us with what U-Boot is doing since commit
ca495f011f ("efi_loader: require at least 128 KiB of stack space").
Reported-by: Ben Pye # IRC
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
common/Kconfig | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/common/Kconfig b/common/Kconfig
index dd13cc756905..2c75844be92d 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -333,8 +333,16 @@ config STACK_BASE
config STACK_SIZE
hex
+ range 0x20000 0xffffffff if EFI_LOADER
+ default 0x20000 if EFI_LOADER
default 0x8000
prompt "Stack size"
+ help
+ Size of the barebox call stack.
+
+ The UEFI specification requires at least 128 KiB of stack space
+ when calling EFI applications. Enforce that minimum for builds
+ that provide the EFI loader.
config MALLOC_SIZE
hex
--
2.47.3
reply other threads:[~2026-06-27 21:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260627212534.3785131-1-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.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