[PATCH master] efi: loader: require at least 128 KiB of stack space
Ahmad Fatoum
a.fatoum at barebox.org
Sat Jun 27 14:25:33 PDT 2026
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 at 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
More information about the barebox
mailing list