Skip to content

Commit b7cc988

Browse files
pa1guptahansendc
authored andcommitted
x86/vmscape: Warn when STIBP is disabled with SMT
Cross-thread attacks are generally harder as they require the victim to be co-located on a core. However, with VMSCAPE the adversary targets belong to the same guest execution, that are more likely to get co-located. In particular, a thread that is currently executing userspace hypervisor (after the IBPB) may still be targeted by a guest execution from a sibling thread. Issue a warning about the potential risk, except when: - SMT is disabled - STIBP is enabled system-wide - Intel eIBRS is enabled (which implies STIBP protection) Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
1 parent 6449f5b commit b7cc988

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3400,6 +3400,28 @@ void cpu_bugs_smt_update(void)
34003400
break;
34013401
}
34023402

3403+
switch (vmscape_mitigation) {
3404+
case VMSCAPE_MITIGATION_NONE:
3405+
case VMSCAPE_MITIGATION_AUTO:
3406+
break;
3407+
case VMSCAPE_MITIGATION_IBPB_ON_VMEXIT:
3408+
case VMSCAPE_MITIGATION_IBPB_EXIT_TO_USER:
3409+
/*
3410+
* Hypervisors can be attacked across-threads, warn for SMT when
3411+
* STIBP is not already enabled system-wide.
3412+
*
3413+
* Intel eIBRS (!AUTOIBRS) implies STIBP on.
3414+
*/
3415+
if (!sched_smt_active() ||
3416+
spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT ||
3417+
spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED ||
3418+
(spectre_v2_in_eibrs_mode(spectre_v2_enabled) &&
3419+
!boot_cpu_has(X86_FEATURE_AUTOIBRS)))
3420+
break;
3421+
pr_warn_once(VMSCAPE_MSG_SMT);
3422+
break;
3423+
}
3424+
34033425
mutex_unlock(&spec_ctrl_mutex);
34043426
}
34053427

0 commit comments

Comments
 (0)