Skip to content

Commit 79ec330

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: Amit Shah <amit.shah@amd.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1cd71b0 commit 79ec330

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

arch/x86/kernel/cpu/bugs.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2890,6 +2890,7 @@ static void __init vmscape_select_mitigation(void)
28902890
#define MDS_MSG_SMT "MDS CPU bug present and SMT on, data leak possible. See https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/mds.html for more details.\n"
28912891
#define TAA_MSG_SMT "TAA CPU bug present and SMT on, data leak possible. See https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/tsx_async_abort.html for more details.\n"
28922892
#define MMIO_MSG_SMT "MMIO Stale Data CPU bug present and SMT on, data leak possible. See https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/processor_mmio_stale_data.html for more details.\n"
2893+
#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"
28932894

28942895
void cpu_bugs_smt_update(void)
28952896
{
@@ -2962,6 +2963,28 @@ void cpu_bugs_smt_update(void)
29622963
break;
29632964
}
29642965

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

0 commit comments

Comments
 (0)