Skip to content

Commit 24f90b7

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 96ab738 commit 24f90b7

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
@@ -2891,6 +2891,8 @@ static void __init vmscape_select_mitigation(void)
28912891
#undef pr_fmt
28922892
#define pr_fmt(fmt) fmt
28932893

2894+
#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"
2895+
28942896
void cpu_bugs_smt_update(void)
28952897
{
28962898
mutex_lock(&spec_ctrl_mutex);
@@ -2962,6 +2964,28 @@ void cpu_bugs_smt_update(void)
29622964
break;
29632965
}
29642966

2967+
switch (vmscape_mitigation) {
2968+
case VMSCAPE_MITIGATION_NONE:
2969+
case VMSCAPE_MITIGATION_AUTO:
2970+
break;
2971+
case VMSCAPE_MITIGATION_IBPB_ON_VMEXIT:
2972+
case VMSCAPE_MITIGATION_IBPB_EXIT_TO_USER:
2973+
/*
2974+
* Hypervisors can be attacked across-threads, warn for SMT when
2975+
* STIBP is not already enabled system-wide.
2976+
*
2977+
* Intel eIBRS (!AUTOIBRS) implies STIBP on.
2978+
*/
2979+
if (!sched_smt_active() ||
2980+
spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT ||
2981+
spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED ||
2982+
(spectre_v2_in_eibrs_mode(spectre_v2_enabled) &&
2983+
!boot_cpu_has(X86_FEATURE_AUTOIBRS)))
2984+
break;
2985+
pr_warn_once(VMSCAPE_MSG_SMT);
2986+
break;
2987+
}
2988+
29652989
mutex_unlock(&spec_ctrl_mutex);
29662990
}
29672991

0 commit comments

Comments
 (0)