Linux EFI development
 help / color / mirror / Atom feed
* [PATCH] efi/libstub: zboot: Round up image size to section alignment
@ 2026-10-28 13:13 Ard Biesheuvel
  0 siblings, 0 replies; only message in thread
From: Ard Biesheuvel @ 2026-10-28 13:13 UTC (permalink / raw)
  To: linux-efi; +Cc: Ard Biesheuvel, Oliver Smith-Denny

From: Ard Biesheuvel <ardb@kernel.org>

Oliver reports that some arm64 EFI boot images have a SizeOfImage field
in the PE header that is set to a value that is not a round multiple of
the image's section alignment, which violates the PE/COFF spec.

This turns out to be a problem in the zboot linker script, and so it
affects compressed EFI zboot images for all architectures, not only
arm64. Uncompressed arm64 images built with an EFI stub are fine, as
those are rounded up to 64k already.

So fix this by bumping the zboot _end marker to the next 4k boundary .

Reported-by: Oliver Smith-Denny <osde@linux.microsoft.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/libstub/zboot.lds | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/libstub/zboot.lds b/drivers/firmware/efi/libstub/zboot.lds
index 367907eb7d86..a785c0123749 100644
--- a/drivers/firmware/efi/libstub/zboot.lds
+++ b/drivers/firmware/efi/libstub/zboot.lds
@@ -45,7 +45,7 @@ SECTIONS
 
 	.bss : {
 		*(.bss* .init.bss*)
-		_end = ALIGN(512);
+		_end = ALIGN(4096);
 		. = _end;
 	}
 
-- 
2.56.0.307.g5fe7bd680c-goog


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

only message in thread, other threads:[~2026-10-28 13:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-28 13:13 [PATCH] efi/libstub: zboot: Round up image size to section alignment Ard Biesheuvel

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