linux-stable/drivers/firmware/efi
Ard Biesheuvel 046545314c x86/boot: Move mem_encrypt= parsing to the decompressor
commit cd0d9d92c8 upstream.

The early SME/SEV code parses the command line very early, in order to
decide whether or not memory encryption should be enabled, which needs
to occur even before the initial page tables are created.

This is problematic for a number of reasons:
- this early code runs from the 1:1 mapping provided by the decompressor
  or firmware, which uses a different translation than the one assumed by
  the linker, and so the code needs to be built in a special way;
- parsing external input while the entire kernel image is still mapped
  writable is a bad idea in general, and really does not belong in
  security minded code;
- the current code ignores the built-in command line entirely (although
  this appears to be the case for the entire decompressor)

Given that the decompressor/EFI stub is an intrinsic part of the x86
bootable kernel image, move the command line parsing there and out of
the core kernel. This removes the need to build lib/cmdline.o in a
special way, or to use RIP-relative LEA instructions in inline asm
blocks.

This involves a new xloadflag in the setup header to indicate
that mem_encrypt=on appeared on the kernel command line.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://lore.kernel.org/r/20240227151907.387873-17-ardb+git@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-10 16:36:07 +02:00
..
libstub x86/boot: Move mem_encrypt= parsing to the decompressor 2024-04-10 16:36:07 +02:00
test
Kconfig efi/libstub: Implement support for unaccepted memory 2023-06-06 16:58:23 +02:00
Makefile efi: Add unaccepted memory support 2023-06-06 17:22:20 +02:00
apple-properties.c
arm-runtime.c efi: runtime: Fix potential overflow of soft-reserved region size 2024-03-01 13:34:55 +01:00
capsule-loader.c efi/capsule-loader: fix incorrect allocation size 2024-03-06 14:48:37 +00:00
capsule.c
cper-arm.c efi/cper: Remove unnecessary aer.h include 2023-04-07 16:42:31 -05:00
cper-x86.c
cper.c EFI updates for v6.2: 2022-12-13 14:31:47 -08:00
cper_cxl.c efi/cper, cxl: Remove cxl_err.h 2023-02-03 23:59:58 +01:00
cper_cxl.h efi/cper, cxl: Decode CXL Protocol Error Section 2022-11-18 09:14:10 +01:00
dev-path-parser.c
earlycon.c efi: earlycon: Reprobe after parsing config tables 2023-03-13 23:28:43 +01:00
efi-bgrt.c
efi-init.c efi: Don't add memblocks for soft-reserved memory 2024-03-01 13:34:55 +01:00
efi-pstore.c EFI updates for v6.2: 2022-12-13 14:31:47 -08:00
efi.c efi: fix panic in kdump kernel 2024-04-03 15:28:52 +02:00
efibc.c
embedded-firmware.c
esrt.c efi/esrt: Allow ESRT access without CAP_SYS_ADMIN 2023-06-06 15:33:59 +02:00
fdtparams.c
memattr.c A healthy mix of EFI contributions this time: 2023-02-23 14:41:48 -08:00
memmap.c
mokvar-table.c
rci2-table.c
reboot.c
riscv-runtime.c efi: runtime: Fix potential overflow of soft-reserved region size 2024-03-01 13:34:55 +01:00
runtime-wrappers.c efi/runtime-wrappers: Clean up white space and add __init annotation 2023-08-22 10:39:26 +02:00
sysfb_efi.c efi: sysfb_efi: Add quirk for Lenovo Yoga Book X91F/L 2023-03-18 11:44:57 +01:00
tpm.c
unaccepted_memory.c efi/unaccepted: Fix off-by-one when checking for overlapping ranges 2023-12-08 08:52:23 +01:00
vars.c efivarfs: expose used and total size 2023-05-17 18:21:34 +02:00