mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] efi: loader: require at least 128 KiB of stack space
@ 2026-06-27 21:25 Ahmad Fatoum
  0 siblings, 0 replies; only message in thread
From: Ahmad Fatoum @ 2026-06-27 21:25 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-27 21:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-27 21:25 [PATCH master] efi: loader: require at least 128 KiB of stack space Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox