1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/arch/x86/boot/compressed
Borislav Petkov (AMD) bee6cf1a80 x86/sev: Do not try to parse for the CC blob on non-AMD hardware
Tao Liu reported a boot hang on an Intel Atom machine due to an unmapped
EFI config table. The reason being that the CC blob which contains the
CPUID page for AMD SNP guests is parsed for before even checking
whether the machine runs on AMD hardware.

Usually that's not a problem on !AMD hw - it simply won't find the CC
blob's GUID and return. However, if any parts of the config table
pointers array is not mapped, the kernel will #PF very early in the
decompressor stage without any opportunity to recover.

Therefore, do a superficial CPUID check before poking for the CC blob.
This will fix the current issue on real hardware. It would also work as
a guest on a non-lying hypervisor.

For the lying hypervisor, the check is done again, *after* parsing the
CC blob as the real CPUID page will be present then.

Clear the #VC handler in case SEV-{ES,SNP} hasn't been detected, as
a precaution.

Fixes: c01fce9cef ("x86/compressed: Add SEV-SNP feature detection/setup")
Reported-by: Tao Liu <ltao@redhat.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Tested-by: Tao Liu <ltao@redhat.com>
Cc: <stable@kernel.org>
Link: https://lore.kernel.org/r/20230601072043.24439-1-ltao@redhat.com
2023-08-07 18:05:13 +02:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
acpi.c x86/boot: Add an efi.h header for the decompressor 2022-04-17 21:15:49 +02:00
cmdline.c x86/boot: Build the command line parsing code unconditionally 2019-02-01 11:51:01 +01:00
cpuflags.c x86/sev-es: Check required CPU features for SEV-ES 2020-09-10 21:49:25 +02:00
early_serial_console.c x86/boot: Put globals that are accessed early into the .data section 2022-04-20 20:10:54 +02:00
efi.c x86/boot: Add an efi.h header for the decompressor 2022-04-17 21:15:49 +02:00
efi.h x86/boot/compressed: Handle unaccepted memory 2023-06-06 17:17:24 +02:00
efi_mixed.S - Do some spring cleaning to the compressed boot code by moving the 2022-12-13 14:45:29 -08:00
error.c x86/tdx: Add unaccepted memory support 2023-06-06 18:25:57 +02:00
error.h x86/tdx: Add unaccepted memory support 2023-06-06 18:25:57 +02:00
head_32.S x86/boot: Robustify calling startup_{32,64}() from the decompressor code 2023-01-09 18:22:21 +01:00
head_64.S x86/boot: Robustify calling startup_{32,64}() from the decompressor code 2023-01-09 18:22:21 +01:00
ident_map_64.c x86/boot: Centralize __pa()/__va() definitions 2023-04-04 13:42:37 -07:00
idt_64.c x86/sev: Do not try to parse for the CC blob on non-AMD hardware 2023-08-07 18:05:13 +02:00
idt_handlers_64.S x86/boot/compressed/64: Setup a GHCB-based VC Exception handler 2020-09-07 19:45:25 +02:00
kaslr.c x86/boot/compressed: Handle unaccepted memory 2023-06-06 17:17:24 +02:00
kernel_info.S x86/boot: Introduce setup_indirect 2019-11-12 16:21:15 +01:00
Makefile - Add support for unaccepted memory as specified in the UEFI spec v2.9. 2023-06-26 15:32:39 -07:00
mem.c x86/sev: Add SNP-specific unaccepted memory support 2023-06-06 18:31:37 +02:00
mem_encrypt.S x86/boot/compressed: Only build mem_encrypt.S if AMD_MEM_ENCRYPT=y 2022-11-24 08:57:41 +01:00
misc.c x86/boot/compressed: Handle unaccepted memory 2023-06-06 17:17:24 +02:00
misc.h x86/boot/compressed: Handle unaccepted memory 2023-06-06 17:17:24 +02:00
mkpiggy.c x86/boot: Remove run-time relocations from head_{32,64}.S 2020-08-14 12:52:35 +02:00
pgtable.h x86/boot: Avoid #VE during boot for TDX platforms 2022-04-07 08:27:53 -07:00
pgtable_64.c x86/boot: Add an efi.h header for the decompressor 2022-04-17 21:15:49 +02:00
sev.c x86/sev: Do not try to parse for the CC blob on non-AMD hardware 2023-08-07 18:05:13 +02:00
sev.h x86/sev: Add SNP-specific unaccepted memory support 2023-06-06 18:31:37 +02:00
string.c x86/boot: Provide KASAN compatible aliases for string routines 2019-05-24 08:44:16 +02:00
tdcall.S x86/boot: Port I/O: Add decompression-time support for TDX 2022-04-07 08:27:52 -07:00
tdx-shared.c x86/tdx: Add unaccepted memory support 2023-06-06 18:25:57 +02:00
tdx.c x86/tdx: Wrap exit reason with hcall_func() 2023-05-23 07:01:45 -07:00
tdx.h x86/tdx: Detect TDX at early kernel decompression time 2022-04-07 08:27:51 -07:00
vmlinux.lds.S cpuidle, tdx: Make TDX code noinstr clean 2023-01-13 11:48:16 +01:00