Commit 3ecacdbd authored by Joerg Roedel's avatar Joerg Roedel Committed by Borislav Petkov

x86/head/64: Don't call verify_cpu() on starting APs

The APs are not ready to handle exceptions when verify_cpu() is called
in secondary_startup_64().
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Link: https://lkml.kernel.org/r/20200907131613.12703-69-joro@8bytes.org
parent 520d0308
...@@ -72,6 +72,7 @@ extern unsigned char startup_32_smp[]; ...@@ -72,6 +72,7 @@ extern unsigned char startup_32_smp[];
extern unsigned char boot_gdt[]; extern unsigned char boot_gdt[];
#else #else
extern unsigned char secondary_startup_64[]; extern unsigned char secondary_startup_64[];
extern unsigned char secondary_startup_64_no_verify[];
#endif #endif
static inline size_t real_mode_size_needed(void) static inline size_t real_mode_size_needed(void)
......
...@@ -125,6 +125,18 @@ SYM_CODE_START(secondary_startup_64) ...@@ -125,6 +125,18 @@ SYM_CODE_START(secondary_startup_64)
/* Sanitize CPU configuration */ /* Sanitize CPU configuration */
call verify_cpu call verify_cpu
/*
* The secondary_startup_64_no_verify entry point is only used by
* SEV-ES guests. In those guests the call to verify_cpu() would cause
* #VC exceptions which can not be handled at this stage of secondary
* CPU bringup.
*
* All non SEV-ES systems, especially Intel systems, need to execute
* verify_cpu() above to make sure NX is enabled.
*/
SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL)
UNWIND_HINT_EMPTY
/* /*
* Retrieve the modifier (SME encryption mask if SME is active) to be * Retrieve the modifier (SME encryption mask if SME is active) to be
* added to the initial pgdir entry that will be programmed into CR3. * added to the initial pgdir entry that will be programmed into CR3.
......
...@@ -46,6 +46,12 @@ static void sme_sev_setup_real_mode(struct trampoline_header *th) ...@@ -46,6 +46,12 @@ static void sme_sev_setup_real_mode(struct trampoline_header *th)
th->flags |= TH_FLAGS_SME_ACTIVE; th->flags |= TH_FLAGS_SME_ACTIVE;
if (sev_es_active()) { if (sev_es_active()) {
/*
* Skip the call to verify_cpu() in secondary_startup_64 as it
* will cause #VC exceptions when the AP can't handle them yet.
*/
th->start = (u64) secondary_startup_64_no_verify;
if (sev_es_setup_ap_jump_table(real_mode_header)) if (sev_es_setup_ap_jump_table(real_mode_header))
panic("Failed to get/update SEV-ES AP Jump Table"); panic("Failed to get/update SEV-ES AP Jump Table");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment