]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
x86/speculation/mds: Add BUG_MSBDS_ONLY
authorThomas Gleixner <tglx@linutronix.de>
Fri, 1 Mar 2019 19:21:08 +0000 (20:21 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 6 May 2019 16:58:12 +0000 (18:58 +0200)
This bug bit is set on CPUs which are only affected by Microarchitectural
Store Buffer Data Sampling (MSBDS) and not by any other MDS variant.

This is important because the Store Buffers are partitioned between
Hyper-Threads so cross thread forwarding is not possible. But if a thread
enters or exits a sleep state the store buffer is repartitioned which can
expose data from one thread to the other. This transition can be mitigated.

That means that for CPUs which are only affected by MSBDS SMT can be
enabled, if the CPU is not affected by other SMT sensitive vulnerabilities,
e.g. L1TF. The XEON PHI variants fall into that category.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
CVE-2018-12126
CVE-2018-12127
CVE-2018-12130

(cherry picked from commit ab12e2e20232e9b84e2b212346b9fe3956e91642)
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/x86/include/asm/cpufeatures.h
arch/x86/kernel/cpu/common.c

index 26d968bed4569551fe41cc902dfeea77582fae64..3bfbf82d3f202f4d928648e2843ebf762b47df9e 100644 (file)
 #define X86_BUG_SPEC_STORE_BYPASS      X86_BUG(17) /* CPU is affected by speculative store bypass attack */
 #define X86_BUG_L1TF                   X86_BUG(18) /* CPU is affected by L1 Terminal Fault */
 #define X86_BUG_MDS                    X86_BUG(19) /* CPU is affected by Microarchitectural data sampling */
+#define X86_BUG_MSBDS_ONLY             X86_BUG(20) /* CPU is only affected by the  MSDBS variant of BUG_MDS */
 
 #endif /* _ASM_X86_CPUFEATURES_H */
index 42b264e5ff9ffb7b52fdd5423e5143251039fe1c..02878a517a18c65f180f86396ed9f9acce2ee617 100644 (file)
@@ -940,6 +940,7 @@ static void identify_cpu_without_cpuid(struct cpuinfo_x86 *c)
 #define NO_SSB         BIT(2)
 #define NO_L1TF                BIT(3)
 #define NO_MDS         BIT(4)
+#define MSBDS_ONLY     BIT(5)
 
 #define VULNWL(_vendor, _family, _model, _whitelist)   \
        { X86_VENDOR_##_vendor, _family, _model, X86_FEATURE_ANY, _whitelist }
@@ -967,8 +968,8 @@ static const __initconst struct x86_cpu_id cpu_vuln_whitelist[] = {
        VULNWL_INTEL(ATOM_SILVERMONT_X,         NO_SSB | NO_L1TF),
        VULNWL_INTEL(ATOM_SILVERMONT_MID,       NO_SSB | NO_L1TF),
        VULNWL_INTEL(ATOM_AIRMONT,              NO_SSB | NO_L1TF),
-       VULNWL_INTEL(XEON_PHI_KNL,              NO_SSB | NO_L1TF),
-       VULNWL_INTEL(XEON_PHI_KNM,              NO_SSB | NO_L1TF),
+       VULNWL_INTEL(XEON_PHI_KNL,              NO_SSB | NO_L1TF | MSBDS_ONLY),
+       VULNWL_INTEL(XEON_PHI_KNM,              NO_SSB | NO_L1TF | MSBDS_ONLY),
 
        VULNWL_INTEL(CORE_YONAH,                NO_SSB),
 
@@ -1016,8 +1017,11 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
        if (ia32_cap & ARCH_CAP_IBRS_ALL)
                setup_force_cpu_cap(X86_FEATURE_IBRS_ENHANCED);
 
-       if (!cpu_matches(NO_MDS) && !(ia32_cap & ARCH_CAP_MDS_NO))
+       if (!cpu_matches(NO_MDS) && !(ia32_cap & ARCH_CAP_MDS_NO)) {
                setup_force_cpu_bug(X86_BUG_MDS);
+               if (cpu_matches(MSBDS_ONLY))
+                       setup_force_cpu_bug(X86_BUG_MSBDS_ONLY);
+       }
 
        if (cpu_matches(NO_MELTDOWN))
                return;