linux/arch/x86/boot
Ard Biesheuvel c00b413a96 x86/boot: Sanitize boot params before parsing command line
The 5-level paging code parses the command line to look for the 'no5lvl'
string, and does so very early, before sanitize_boot_params() has been
called and has been given the opportunity to wipe bogus data from the
fields in boot_params that are not covered by struct setup_header, and
are therefore supposed to be initialized to zero by the bootloader.

This triggers an early boot crash when using syslinux-efi to boot a
recent kernel built with CONFIG_X86_5LEVEL=y and CONFIG_EFI_STUB=n, as
the 0xff padding that now fills the unused PE/COFF header is copied into
boot_params by the bootloader, and interpreted as the top half of the
command line pointer.

Fix this by sanitizing the boot_params before use. Note that there is no
harm in calling this more than once; subsequent invocations are able to
spot that the boot_params have already been cleaned up.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: <stable@vger.kernel.org> # v6.1+
Link: https://lore.kernel.org/r/20250306155915.342465-2-ardb+git@google.com
Closes: https://lore.kernel.org/all/202503041549.35913.ulrich.gemkow@ikr.uni-stuttgart.de
2025-03-06 22:02:39 +01:00
..
compressed x86/boot: Sanitize boot params before parsing command line 2025-03-06 22:02:39 +01:00
tools x86/boot: Increase section and file alignment to 4k/512 2023-09-17 19:48:44 +02:00
.gitignore
Makefile Miscellaneous fixes: 2024-05-19 11:42:29 -07:00
a20.c
apm.c
bioscall.S x86/boot: Avoid using Intel mnemonics in AT&T syntax asm 2023-01-10 13:03:23 +01:00
bitops.h x86/boot: Remove superfluous type casting from arch/x86/boot/bitops.h 2022-08-15 19:17:43 +02:00
boot.h x86/boot: Remove unused function atou() 2024-11-07 18:08:23 +01:00
cmdline.c
copy.S
cpu.c x86/cpu: Remove X86_FEATURE_NAMES 2023-05-15 20:03:08 +02:00
cpucheck.c x86/boot: Switch to new Intel CPU model defines 2024-05-28 10:59:03 -07:00
cpuflags.c x86/boot: Remove x86_32 PIC using %ebx workaround 2022-11-29 16:26:53 +01:00
cpuflags.h
ctype.h
early_serial_console.c
edd.c
genimage.sh
header.S efi/x86: Set the PE/COFF header's NX compat flag unconditionally 2024-02-28 14:23:55 +01:00
install.sh kbuild: Abort make on install failures 2024-07-20 13:34:54 +09:00
io.h x86/boot: Port I/O: Allow to hook up alternative helpers 2022-04-07 08:27:52 -07:00
main.c x86/boot: Clean up the arch/x86/boot/main.c code a bit 2024-05-22 09:36:49 +02:00
memory.c
mkcpustr.c
msr.h
mtools.conf.in
pm.c x86/asm: Always set A (accessed) flag in GDT descriptors 2023-12-20 10:57:51 +01:00
pmjump.S
printf.c x86/boot: Address clang -Wimplicit-fallthrough in vsprintf() 2024-05-17 09:22:56 +02:00
regs.c
setup.ld x86/efistub: Use 1:1 file:memory mapping for PE/COFF .compat section 2024-02-05 10:24:51 +00:00
string.c x86/boot: Remove unused function atou() 2024-11-07 18:08:23 +01:00
string.h x86/boot: Remove unused function atou() 2024-11-07 18:08:23 +01:00
tty.c
version.c kbuild: build init/built-in.a just once 2022-09-29 04:40:15 +09:00
vesa.h
video-bios.c
video-mode.c
video-vesa.c
video-vga.c
video.c
video.h