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
  2026-06-29  7:31 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages 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] 2+ messages in thread

* Re: [PATCH master] efi: loader: require at least 128 KiB of stack space
  2026-06-27 21:25 [PATCH master] efi: loader: require at least 128 KiB of stack space Ahmad Fatoum
@ 2026-06-29  7:31 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2026-06-29  7:31 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Sat, 27 Jun 2026 23:25:33 +0200, Ahmad Fatoum wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] efi: loader: require at least 128 KiB of stack space
      https://git.pengutronix.de/cgit/barebox/commit/?id=dcd77b9dca3f (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-29  7:33 UTC | newest]

Thread overview: 2+ messages (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
2026-06-29  7:31 ` Sascha Hauer

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