2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/drivers/firmware/efi/libstub
Vitaly Kuznetsov f8b53cc917 efi: Fix .data section size calculations when .sbat is present
Commit 0f9a1739dd ("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: 0f9a1739dd ("efi: zboot specific mechanism for embedding SBAT section")
Reported-by: Heinrich Schuchardt <heinrich.schuchardt@gmx.de>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2025-06-20 13:36:14 +02:00
..
alignedmem.c efi/libstub: Add one kernel-doc comment 2024-01-30 21:44:21 +01:00
arm32-stub.c efi: libstub: Move screen_info handling to common code 2022-11-09 12:42:02 +01:00
arm64-stub.c arm64/efistub: Clean up KASLR logic 2024-07-10 12:22:46 +02:00
arm64.c efistub/smbios: Simplify SMBIOS enumeration API 2024-07-02 00:42:04 +02:00
bitmap.c efi/libstub: Implement support for unaccepted memory 2023-06-06 16:58:23 +02:00
efi-stub-entry.c efi: move screen_info into efi init code 2023-10-17 16:33:39 +02:00
efi-stub-helper.c efi/libstub: Describe missing 'out' parameter in efi_load_initrd 2025-05-09 11:24:00 +02:00
efi-stub.c efi/libstub: Use __free() helper for pool deallocations 2025-01-14 08:35:27 +01:00
efistub.h efi/libstub: Avoid legacy decompressor zlib/zstd wrappers 2025-03-14 12:36:11 +01:00
fdt.c efi: libstub: only free priv.runtime_map when allocated 2024-04-29 17:47:32 +02:00
file.c efi/libstub: Take command line overrides into account for loaded files 2024-11-17 08:54:01 +01:00
find.c efi/libstub: Implement support for unaccepted memory 2023-06-06 16:58:23 +02:00
gop.c efi/libstub: Refactor and clean up GOP resolution picker code 2025-01-14 08:35:27 +01:00
intrinsics.c efi/libstub: Avoid CopyMem/SetMem EFI services after ExitBootServices 2025-03-13 11:52:05 +01:00
kaslr.c efi/libstub: Use cleanup helpers for freeing copies of the memory map 2025-01-14 08:35:27 +01:00
loongarch-stub.c efi/loongarch: Directly position the loaded image file 2023-12-19 11:16:37 +01:00
loongarch-stub.h efi/loongarch: Directly position the loaded image file 2023-12-19 11:16:37 +01:00
loongarch.c LoongArch: Add writecombine support for DMW-based ioremap() 2024-07-20 22:40:59 +08:00
Makefile Kbuild updates for v6.16 2025-06-07 10:05:35 -07:00
Makefile.zboot efi: zboot specific mechanism for embedding SBAT section 2025-05-21 15:31:42 +02:00
mem.c efi/libstub: Use cleanup helpers for freeing copies of the memory map 2025-01-14 08:35:27 +01:00
pci.c efi/libstub: Simplify PCI I/O handle buffer traversal 2025-01-14 08:35:27 +01:00
printk.c efi: libstub: Enable efi_printk() in zboot decompressor 2022-11-09 12:42:02 +01:00
random.c efi: stub: use random seed from EFI variable 2022-12-01 09:51:21 +01:00
randomalloc.c efi/libstub: Avoid physical address 0x0 when doing random allocation 2025-03-14 12:21:29 +01:00
relocate.c efi: Avoid cold plugged memory for placing the kernel 2025-02-04 14:08:22 +01:00
riscv-stub.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
riscv.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
screen_info.c efi/libstub: Zero initialize heap allocated struct screen_info 2024-07-17 22:51:20 +02:00
secureboot.c efi: libstub: check Shim mode using MokSBStateRT 2022-09-22 10:15:44 +02:00
skip_spaces.c efi/libstub: Fix missing-prototype warning for skip_spaces() 2020-06-15 19:43:58 +02:00
smbios.c x86/efistub: Enable SMBIOS protocol handling for x86 2024-07-08 10:17:44 +02:00
string.c efi: libstub: Provide local implementations of strrchr() and memchr() 2022-11-09 12:42:02 +01:00
systable.c efi/libstub: move efi_system_table global var into separate object 2022-09-19 11:19:35 +02:00
tpm.c libstub,tpm: do not ignore failure case when reading final event log 2024-10-15 20:27:30 +02:00
unaccepted_memory.c mm: rework accept memory helpers 2024-09-01 20:26:07 -07:00
vsprintf.c isystem: ship and use stdarg.h 2021-08-19 09:02:55 +09:00
x86-5lvl.c x86/mm/64: Make 5-level paging support unconditional 2025-05-17 10:38:16 +02:00
x86-stub.c x86/efistub: Merge PE and handover entrypoints 2025-02-21 16:54:05 +01:00
x86-stub.h x86/efistub: Give up if memory attribute protocol returns an error 2024-01-26 16:58:19 +01:00
zboot-decompress-gzip.c efi/libstub: Avoid legacy decompressor zlib/zstd wrappers 2025-03-14 12:36:11 +01:00
zboot-decompress-zstd.c efi/libstub: Avoid legacy decompressor zlib/zstd wrappers 2025-03-14 12:36:11 +01:00
zboot-header.S include: pe.h: Fix PE definitions 2025-05-21 16:46:37 +02:00
zboot.c efi/libstub: Avoid legacy decompressor zlib/zstd wrappers 2025-03-14 12:36:11 +01:00
zboot.lds efi: Fix .data section size calculations when .sbat is present 2025-06-20 13:36:14 +02:00