linux-stable/arch/x86/mm
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
..
pat x86/mm/pat: fix VM_PAT handling in COW mappings 2024-04-10 16:36:03 +02:00
amdtopology.c
cpu_entry_area.c x86/mm: Do not shuffle CPU entry areas without KASLR 2023-03-22 10:42:47 -07:00
debug_pagetables.c x86/mm/dump_pagetables: remove MODULE_LICENSE in non-modules 2023-04-13 13:13:54 -07:00
dump_pagetables.c
extable.c x86-64: mm: clarify the 'positive addresses' user address rules 2023-05-03 10:37:22 -07:00
fault.c mm/treewide: replace pud_large() with pud_leaf() 2024-04-10 16:35:46 +02:00
highmem_32.c x86/mm: Include asm/numa.h for set_highmem_pages_init() 2023-05-18 11:56:18 -07:00
hugetlbpage.c
ident_map.c Revert "x86/mm/ident_map: Use gbpages only where full GB page should be mapped." 2024-04-10 16:35:46 +02:00
init.c - Remove unnecessary "INVPCID single" feature tracking 2023-08-30 09:54:00 -07:00
init_32.c x86/mm: Remove Xen-PV leftovers from init_32.c 2023-06-09 11:00:21 +02:00
init_64.c mm/treewide: replace pud_large() with pud_leaf() 2024-04-10 16:35:46 +02:00
iomap_32.c
ioremap.c x86/ioremap: Add hypervisor callback for private MMIO mapping in coco VM 2023-03-26 23:42:40 +02:00
kasan_init_64.c mm/treewide: replace pud_large() with pud_leaf() 2024-04-10 16:35:46 +02:00
kaslr.c x86/mm: Avoid using set_pgd() outside of real PGD pages 2023-06-16 11:46:42 -07:00
kmmio.c
kmsan_shadow.c
maccess.c x86/mm: Disallow vsyscall page read for copy_from_kernel_nofault() 2024-03-26 18:19:12 -04:00
Makefile
mem_encrypt.c
mem_encrypt_amd.c x86/sev: Skip ROM range scans and validation for SEV-SNP guests 2024-04-03 15:29:03 +02:00
mem_encrypt_boot.S x86/mm: Remove P*D_PAGE_MASK and P*D_PAGE_SIZE macros 2022-12-15 10:37:27 -08:00
mem_encrypt_identity.c x86/boot: Move mem_encrypt= parsing to the decompressor 2024-04-10 16:36:07 +02:00
mm_internal.h
mmap.c
mmio-mod.c
numa.c x86/numa: Fix the sort compare func used in numa_fill_memblks() 2024-03-01 13:35:06 +01:00
numa_32.c
numa_64.c
numa_emulation.c
numa_internal.h
pf_in.c
pf_in.h
pgprot.c
pgtable.c mm/treewide: replace pud_large() with pud_leaf() 2024-04-10 16:35:46 +02:00
pgtable_32.c
physaddr.c
physaddr.h
pkeys.c
pti.c mm/treewide: replace pud_large() with pud_leaf() 2024-04-10 16:35:46 +02:00
srat.c x86/apic: Wrap APIC ID validation into an inline 2023-08-09 11:58:30 -07:00
testmmiotrace.c
tlb.c - Remove unnecessary "INVPCID single" feature tracking 2023-08-30 09:54:00 -07:00