Skip to content

Commit 8d67561

Browse files
pa1guptagregkh
authored andcommitted
x86/vmscape: Warn when STIBP is disabled with SMT
Commit b7cc988 upstream. 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 <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 28504e3 commit 8d67561

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2951,6 +2951,8 @@ static void __init vmscape_select_mitigation(void)
29512951
#undef pr_fmt
29522952
#define pr_fmt(fmt) fmt
29532953

2954+
#define VMSCAPE_MSG_SMT "VMSCAPE: SMT on, STIBP is required for full protection. See https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/vmscape.html for more details.\n"
2955+
29542956
void cpu_bugs_smt_update(void)
29552957
{
29562958
mutex_lock(&spec_ctrl_mutex);
@@ -3022,6 +3024,28 @@ void cpu_bugs_smt_update(void)
30223024
break;
30233025
}
30243026

3027+
switch (vmscape_mitigation) {
3028+
case VMSCAPE_MITIGATION_NONE:
3029+
case VMSCAPE_MITIGATION_AUTO:
3030+
break;
3031+
case VMSCAPE_MITIGATION_IBPB_ON_VMEXIT:
3032+
case VMSCAPE_MITIGATION_IBPB_EXIT_TO_USER:
3033+
/*
3034+
* Hypervisors can be attacked across-threads, warn for SMT when
3035+
* STIBP is not already enabled system-wide.
3036+
*
3037+
* Intel eIBRS (!AUTOIBRS) implies STIBP on.
3038+
*/
3039+
if (!sched_smt_active() ||
3040+
spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT ||
3041+
spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED ||
3042+
(spectre_v2_in_eibrs_mode(spectre_v2_enabled) &&
3043+
!boot_cpu_has(X86_FEATURE_AUTOIBRS)))
3044+
break;
3045+
pr_warn_once(VMSCAPE_MSG_SMT);
3046+
break;
3047+
}
3048+
30253049
mutex_unlock(&spec_ctrl_mutex);
30263050
}
30273051

0 commit comments

Comments
 (0)