Skip to content

Commit 1e1dc1f

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 <pawan.kumar.gupta@linux.intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a5d029f commit 1e1dc1f

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

arch/x86/kernel/cpu/bugs.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,6 +2942,8 @@ static void __init vmscape_select_mitigation(void)
29422942
#undef pr_fmt
29432943
#define pr_fmt(fmt) fmt
29442944

2945+
#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"
2946+
29452947
void cpu_bugs_smt_update(void)
29462948
{
29472949
mutex_lock(&spec_ctrl_mutex);
@@ -3013,6 +3015,28 @@ void cpu_bugs_smt_update(void)
30133015
break;
30143016
}
30153017

3018+
switch (vmscape_mitigation) {
3019+
case VMSCAPE_MITIGATION_NONE:
3020+
case VMSCAPE_MITIGATION_AUTO:
3021+
break;
3022+
case VMSCAPE_MITIGATION_IBPB_ON_VMEXIT:
3023+
case VMSCAPE_MITIGATION_IBPB_EXIT_TO_USER:
3024+
/*
3025+
* Hypervisors can be attacked across-threads, warn for SMT when
3026+
* STIBP is not already enabled system-wide.
3027+
*
3028+
* Intel eIBRS (!AUTOIBRS) implies STIBP on.
3029+
*/
3030+
if (!sched_smt_active() ||
3031+
spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT ||
3032+
spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED ||
3033+
(spectre_v2_in_eibrs_mode(spectre_v2_enabled) &&
3034+
!boot_cpu_has(X86_FEATURE_AUTOIBRS)))
3035+
break;
3036+
pr_warn_once(VMSCAPE_MSG_SMT);
3037+
break;
3038+
}
3039+
30163040
mutex_unlock(&spec_ctrl_mutex);
30173041
}
30183042

0 commit comments

Comments
 (0)