OpenCloudOS-Kernel/arch/x86/boot/compressed
Michael Roth 4b1c742407 x86/boot: Don't propagate uninitialized boot_params->cc_blob_address
In some cases, bootloaders will leave boot_params->cc_blob_address
uninitialized rather than zeroing it out. This field is only meant to be
set by the boot/compressed kernel in order to pass information to the
uncompressed kernel when SEV-SNP support is enabled.

Therefore, there are no cases where the bootloader-provided values
should be treated as anything other than garbage. Otherwise, the
uncompressed kernel may attempt to access this bogus address, leading to
a crash during early boot.

Normally, sanitize_boot_params() would be used to clear out such fields
but that happens too late: sev_enable() may have already initialized
it to a valid value that should not be zeroed out. Instead, have
sev_enable() zero it out unconditionally beforehand.

Also ensure this happens for !CONFIG_AMD_MEM_ENCRYPT as well by also
including this handling in the sev_enable() stub function.

  [ bp: Massage commit message and comments. ]

Fixes: b190a043c4 ("x86/sev: Add SEV-SNP feature detection/setup")
Reported-by: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com>
Reported-by: watnuss@gmx.de
Signed-off-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: stable@vger.kernel.org
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216387
Link: https://lore.kernel.org/r/20220823160734.89036-1-michael.roth@amd.com
2022-08-24 09:03:04 +02:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
Makefile x86: link vdso and boot with -z noexecstack --no-warn-rwx-segments 2022-08-10 18:30:09 -07: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: Add an efi.h header for the decompressor 2022-04-17 21:15:49 +02:00
efi_thunk_64.S - Get rid of all the .fixup sections because this generates 2022-01-12 16:31:19 -08:00
error.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
error.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
head_32.S x86: clean up symbol aliasing 2022-02-22 16:21:34 +00:00
head_64.S Intel Trust Domain Extensions 2022-05-23 17:51:12 -07:00
ident_map_64.c x86/compressed/64: Add identity mappings for setup_data entries 2022-07-06 11:23:39 +02:00
idt_64.c x86/sev: Check SEV-SNP features support 2022-04-06 13:10:23 +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: Add an efi.h header for the decompressor 2022-04-17 21:15:49 +02:00
kernel_info.S x86/boot: Introduce setup_indirect 2019-11-12 16:21:15 +01:00
mem_encrypt.S x86/compressed/64: Detect/setup SEV/SME features earlier during boot 2022-04-06 13:02:21 +02:00
misc.c Intel Trust Domain Extensions 2022-05-23 17:51:12 -07:00
misc.h x86/boot: Don't propagate uninitialized boot_params->cc_blob_address 2022-08-24 09:03:04 +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/boot: Don't propagate uninitialized boot_params->cc_blob_address 2022-08-24 09:03:04 +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.c x86/boot: Port I/O: Add decompression-time support for TDX 2022-04-07 08:27:52 -07:00
tdx.h x86/tdx: Detect TDX at early kernel decompression time 2022-04-07 08:27:51 -07:00
vmlinux.lds.S x86/boot/compressed: Add missing debugging sections to output 2020-09-01 10:03:18 +02:00