Skip to content

Commit f8b53cc

Browse files
vittyvkardbiesheuvel
authored andcommitted
efi: Fix .data section size calculations when .sbat is present
Commit 0f9a173 ("efi: zboot specific mechanism for embedding SBAT section") neglected to adjust the sizes of the .data section when CONFIG_EFI_SBAT_FILE is set. As the result, the produced PE binary is incorrect and some tools complain about it. E.g. 'sbsign' reports: # sbsign --key my.key --cert my.crt arch/arm64/boot/vmlinuz.efi warning: file-aligned section .data extends beyond end of file warning: checksum areas are greater than image size. Invalid section table? Note, '__data_size' is also used in the PE optional header and it is not entirely clear whether .sbat needs to be accounted as part of SizeOfInitializedData or not. As the header seems to be unused by the real world firmware, keeping the field equal to __data_size. Fixes: 0f9a173 ("efi: zboot specific mechanism for embedding SBAT section") Reported-by: Heinrich Schuchardt <[email protected]> Signed-off-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent c33453d commit f8b53cc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/firmware/efi/libstub/zboot.lds

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ SECTIONS
5858
PROVIDE(__efistub__gzdata_size =
5959
ABSOLUTE(__efistub__gzdata_end - __efistub__gzdata_start));
6060

61-
PROVIDE(__data_rawsize = ABSOLUTE(_edata - _etext));
62-
PROVIDE(__data_size = ABSOLUTE(_end - _etext));
61+
PROVIDE(__data_rawsize = ABSOLUTE(_edata - _data));
62+
PROVIDE(__data_size = ABSOLUTE(_end - _data));
6363
PROVIDE(__sbat_size = ABSOLUTE(_esbat - _sbat));

0 commit comments

Comments
 (0)