linux-stable/arch
Ard Biesheuvel 0a962f2fba x86/efistub: Use 1:1 file:memory mapping for PE/COFF .compat section
commit 1ad55cecf2 upstream.

The .compat section is a dummy PE section that contains the address of
the 32-bit entrypoint of the 64-bit kernel image if it is bootable from
32-bit firmware (i.e., CONFIG_EFI_MIXED=y)

This section is only 8 bytes in size and is only referenced from the
loader, and so it is placed at the end of the memory view of the image,
to avoid the need for padding it to 4k, which is required for sections
appearing in the middle of the image.

Unfortunately, this violates the PE/COFF spec, and even if most EFI
loaders will work correctly (including the Tianocore reference
implementation), PE loaders do exist that reject such images, on the
basis that both the file and memory views of the file contents should be
described by the section headers in a monotonically increasing manner
without leaving any gaps.

So reorganize the sections to avoid this issue. This results in a slight
padding overhead (< 4k) which can be avoided if desired by disabling
CONFIG_EFI_MIXED (which is only needed in rare cases these days)

Fixes: 3e3eabe26d ("x86/boot: Increase section and file alignment to 4k/512")
Reported-by: Mike Beaton <mjsbeaton@gmail.com>
Link: https://lkml.kernel.org/r/CAHzAAWQ6srV6LVNdmfbJhOwhBw5ZzxxZZ07aHt9oKkfYAdvuQQ%40mail.gmail.com
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-23 09:25:27 +01:00
..
alpha rtc: Add support for configuring the UIP timeout for RTC reads 2024-01-31 16:18:56 -08:00
arc work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
arm work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
arm64 arm64: Subscribe Microsoft Azure Cobalt 100 to ARM Neoverse N2 errata 2024-02-23 09:25:14 +01:00
csky work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
hexagon
ia64 cpu-hotplug: Provide prototypes for arch CPU registration 2023-10-11 14:27:37 +02:00
loongarch LoongArch: Fix earlycon parameter if KASAN enabled 2024-02-23 09:25:16 +01:00
m68k mm: Introduce flush_cache_vmap_early() 2024-02-16 19:10:52 +01:00
microblaze
mips ptrace: Introduce exception_ip arch hook 2024-02-23 09:24:53 +01:00
nios2 mm: Introduce flush_cache_vmap_early() 2024-02-16 19:10:52 +01:00
openrisc
parisc parisc: Fix random data corruption from exception handler 2024-02-23 09:25:18 +01:00
powerpc powerpc/pseries: fix accuracy of stolen time 2024-02-23 09:25:09 +01:00
riscv work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
s390 work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
sh mm: Introduce flush_cache_vmap_early() 2024-02-16 19:10:52 +01:00
sparc work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
um um: Fix adding '-no-pie' for clang 2024-02-23 09:25:03 +01:00
x86 x86/efistub: Use 1:1 file:memory mapping for PE/COFF .compat section 2024-02-23 09:25:27 +01:00
xtensa work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
.gitignore
Kconfig scs: add CONFIG_MMU dependency for vfree_atomic() 2024-02-23 09:24:54 +01:00