MDS basics 0
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v6 Latest14 patches 44 repliesIn review
- v514 patches 29 repliesSuperseded
- v411 patches 35 repliesSuperseded
Earlier versions · 3
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v3 | 9 patches | 22 replies | Superseded | |
| v2 | 10 patches | 46 replies | Superseded | |
| v1 | 8 patches | 33 replies | Superseded |
Changes in v6 from the cover letter
- Fix tools/ build (Josh)
- Dropped the AIRMONT_MID change as it needs confirmation from Intel
- Made the consolidated whitelist more readable and correct
- Added the MSBDS only quirk for XEON PHI, made the idle flush depend on it and updated the sysfs output accordingly.
- Fixed the protection matrix in the admin documentation and clarified the SMT situation vs. MSBDS only.
- Updated the KVM/VMX changelog.
Patches in v6 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/14 | MDS basics 1arch/ tools/ tools/ | +20 | 1 reply | |
| 2/14 | MDS basics 2arch/ | +60 | 3 replies | |
| 3/14 | MDS basics 3arch/ arch/ arch/ | +24 | 1 reply | |
| 4/14 | MDS basics 4arch/ arch/ | +8 | 6 replies | |
| 5/14 | MDS basics 5arch/ | +2 | 3 replies | |
| 6/14 | MDS basics 6Documentation/ Documentation/ Documentation/ +2 more | +143 | 2 replies | |
| 7/14 | MDS basics 7Documentation/ arch/ arch/ +3 more | +82 | 4 replies | |
| 8/14 | MDS basics 8arch/ arch/ | +3 | 7 replies | |
| 9/14 | MDS basics 9Documentation/ arch/ arch/ +2 more | +68 | 1 reply | |
| 10/14 | MDS basics 10Documentation/ arch/ arch/ | +95 | 7 replies | |
| 11/14 | MDS basics 11Documentation/ arch/ drivers/ +1 more | +36 | 0 replies | |
| 12/14 | MDS basics 12Documentation/ arch/ arch/ | +40 | 4 replies | |
| 13/14 | MDS basics 13Documentation/ Documentation/ Documentation/ +1 more | +628 | 3 replies | |
| 14/14 | MDS basics 14Documentation/ Documentation/ Documentation/ | +309 | 0 replies |
Reviews trailers per patch
13 of 14 patches have a Reviewed-by or Acked-by.
| Patch | Greg Kroah-Hartman | Borislav Petkov | Frederic Weisbecker |
|---|---|---|---|
| 1/14 | R-b | R-b | R-b |
| 2/14 | R-b | R-b | R-b |
| 3/14 | R-b | R-b | R-b |
| 4/14 | R-b | ||
| 5/14 | R-b | R-b | R-b |
| 6/14 | R-b | R-b | R-b |
| 7/14 | R-b | R-b | R-b |
| 8/14 | R-b | R-b | R-b |
| 9/14 | R-b | R-b | R-b |
| 10/14 | R-b | ||
| 11/14 | R-b | R-b | |
| 12/14 | R-b | ||
| 13/14 | R-b | ||
| 14/14 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [patch V6 00/14] MDS basics 0
Changes vs. V5:
- Fix tools/ build (Josh)
- Dropped the AIRMONT_MID change as it needs confirmation from Intel
- Made the consolidated whitelist more readable and correct
- Added the MSBDS only quirk for XEON PHI, made the idle flush depend on it and updated the sysfs output accordingly.
- Fixed the protection matrix in the admin documentation and clarified the SMT situation vs. MSBDS only.
- Updated the KVM/VMX changelog.
Delta patch against V5 below.
Available from git:
cvs.ou.linutronix.de:linux/speck/linux WIP.mds
The linux-4.20.y, linux-4.19.y and linux-4.14.y branches are updated as well and contain the untested backports of the pile for reference.
I'll send git bundles of the pile as well.
Thanks,
tglx
8<---------------------------
Documentation/admin-guide/hw-vuln/mds.rst +35 -14
@@ -23,6 +23,10 @@ vulnerability is not present on: Whether a processor is affected or not can be read out from the MDS vulnerability file in sysfs. See :ref:`mds_sys_info`. +Not all processors are affected by all variants of MDS, but the mitigation +is identical for all of them so the kernel treats them as a single +vulnerability. + Related CVEs ------------
@@ -112,6 +116,7 @@ to the above information: ======================== ============================================ 'SMT vulnerable' SMT is enabled + 'SMT mitigated' SMT is enabled and mitigated 'SMT disabled' SMT is disabled 'SMT Host state unknown' Kernel runs in a VM, Host SMT state unknown ======================== ============================================
@@ -153,8 +158,12 @@ CPU buffer clearing The mitigation for MDS clears the affected CPU buffers on return to user space and when entering a guest. - If SMT is enabled it also clears the buffers on idle entry, but that's not - a sufficient SMT protection for all MDS variants; it covers solely MSBDS. + If SMT is enabled it also clears the buffers on idle entry when the CPU + is only affected by MSBDS and not any other MDS variant, because the + other variants cannot be protected against cross Hyper-Thread attacks. + + For CPUs which are only affected by MSBDS the user space, guest and idle + transition mitigations are sufficient and SMT is not affected. .. _virt_mechanism:
@@ -168,8 +177,10 @@ Virtualization mitigation If the L1D flush mitigation is enabled and up to date microcode is available, the L1D flush mitigation is automatically protecting the - guest transition. If the L1D flush mitigation is disabled the MDS - mitigation is disabled as well. + guest transition. + + If the L1D flush mitigation is disabled then the MDS mitigation is + invoked explicit when the host MDS mitigation is enabled. For details on L1TF and virtualization see: :ref:`Documentation/admin-guide/hw-vuln//l1tf.rst <mitigation_control_kvm>`.
@@ -177,16 +188,18 @@ Virtualization mitigation - CPU is not affected by L1TF: CPU buffers are flushed before entering the guest when the host MDS - protection is enabled. + mitigation is enabled. The resulting MDS protection matrix for the host to guest transition: ============ ===== ============= ============ ================= - L1TF MDS VMX-L1FLUSH Host MDS State + L1TF MDS VMX-L1FLUSH Host MDS MDS-State Don't care No Don't care N/A Not affected - Yes Yes Disabled Don't care Vulnerable + Yes Yes Disabled Off Vulnerable + + Yes Yes Disabled Full Mitigated Yes Yes Enabled Don't care Mitigated
@@ -196,7 +209,7 @@ Virtualization mitigation ============ ===== ============= ============ ================= This only covers the host to guest transition, i.e. prevents leakage from - host to guest, but does not protect the guest internally. Guest need to + host to guest, but does not protect the guest internally. Guests need to have their own protections. .. _xeon_phi:
@@ -210,14 +223,22 @@ XEON PHI specific considerations for malicious user space. The exposure can be disabled on the kernel command line with the 'ring3mwait=disable' command line option. + XEON PHI is not affected by the other MDS variants and MSBDS is mitigated + before the CPU enters a idle state. As XEON PHI is not affected by L1TF + either disabling SMT is not required for full protection. + .. _mds_smt_control: SMT control ^^^^^^^^^^^ - To prevent the SMT issues of MDS it might be necessary to disable SMT - completely. Disabling SMT can have a significant performance impact, but - the impact depends on the type of workloads. + All MDS variants except MSBDS can be attacked cross Hyper-Threads. That + means on CPUs which are affected by MFBDS or MLPDS it is necessary to + disable SMT for full protection. These are most of the affected CPUs; the + exception is XEON PHI, see :ref:`xeon_phi`. + + Disabling SMT can have a significant performance impact, but the impact + depends on the type of workloads. See the relevant chapter in the L1TF mitigation documentation for details: :ref:`Documentation/admin-guide/hw-vuln/l1tf.rst <smt_control>`.
@@ -260,9 +281,7 @@ Mitigation selection guide 2. Virtualization with trusted guests ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - The same considerations as above versus trusted user space apply. See - also: :ref:`Documentation/admin-guide/hw-vuln//l1tf.rst <mitigation_selection>`. - + The same considerations as above versus trusted user space apply. 3. Virtualization with untrusted guests ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -270,6 +289,8 @@ Mitigation selection guide The protection depends on the state of the L1TF mitigations. See :ref:`virt_mechanism`. + If the MDS mitigation is enabled and SMT is disabled, guest to host and + guest to guest attacks are prevented. .. _mds_default_mitigations:
Documentation/x86/mds.rst +18 -11
@@ -107,19 +107,19 @@ user space or VM guests. Kernel internal mitigation modes -------------------------------- - ======= =========================================================== - off Mitigation is disabled. Either the CPU is not affected or - mds=off is supplied on the kernel command line + ======= ============================================================ + off Mitigation is disabled. Either the CPU is not affected or + mds=off is supplied on the kernel command line - full Mitigation is eanbled. CPU is affected and MD_CLEAR is - advertised in CPUID. + full Mitigation is eanbled. CPU is affected and MD_CLEAR is + advertised in CPUID. - vmwerv Mitigation is enabled. CPU is affected and MD_CLEAR is not - advertised in CPUID. That is mainly for virtualization - scenarios where the host has the updated microcode but the - hypervisor does not expose MD_CLEAR in CPUID. It's a best - effort approach without guarantee. - ======= =========================================================== + vmwerv Mitigation is enabled. CPU is affected and MD_CLEAR is not + advertised in CPUID. That is mainly for virtualization + scenarios where the host has the updated microcode but the + hypervisor does not expose MD_CLEAR in CPUID. It's a best + effort approach without guarantee. + ======= ============================================================ If the CPU is affected and mds=off is not supplied on the kernel command line then the kernel selects the appropriate mitigation mode depending on
@@ -189,6 +189,13 @@ Mitigation points When SMT is inactive, i.e. either the CPU does not support it or all sibling threads are offline CPU buffer clearing is not required. + The idle clearing is enabled on CPUs which are only affected by MSBDS + and not by any other MDS variant. The other MDS variants cannot be + protected against cross Hyper-Thread attacks because the Fill Buffer and + the Load Ports are shared. So on CPUs affected by other variants, the + idle clearing would be a window dressing exercise and is therefore not + activated. + The invocation is controlled by the static key mds_idle_clear which is switched depending on the chosen mitigation mode and the SMT state of the system.
arch/x86/include/asm/cpufeatures.h +1 -0
@@ -383,5 +383,6 @@#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 */
arch/x86/kernel/cpu/bugs.c +14 -0
@@ -667,6 +667,15 @@ static void update_indir_branch_cond(void)/* Update the static key controlling the MDS CPU buffer clear in idle */ static void update_mds_branch_idle (void ) { +/* +* Enable the idle clearing on CPUs which are affected only by +* MDBDS and not any other MDS variant. The other variants cannot +* be mitigated when SMT is enabled, so clearing the buffers on +* idle would be a window dressing exercise. +*/ +if (!boot_cpu_has (X86_BUG_MSBDS_ONLY )) +return ; +if (sched_smt_active ())static_branch_enable (&mds_idle_clear);else
@@ -1174,6 +1183,11 @@ static ssize_t mds_show_state(char *buf) mds_strings[mds_mitigation]); } +if (boot_cpu_has (X86_BUG_MSBDS_ONLY )) { +return sprintf (buf,"%s; SMT %s\n" , mds_strings[mds_mitigation], +sched_smt_active () ?"mitigated" :"disabled" ); + } +return sprintf (buf,"%s; SMT %s\n" , mds_strings[mds_mitigation],sched_smt_active () ?"vulnerable" :"disabled" ); }
arch/x86/kernel/cpu/common.c +53 -31
99 lines not on this page · raw message
tools/power/x86/turbostat/Makefile +1 -1
@@ -9,7 +9,7 @@ ifeq ("$(origin O)", "command line") endif turbostat : turbostat.c -override CFLAGS += -Wall +override CFLAGS += -Wall -I../../../include override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' override CFLAGS += -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"'
tools/power/x86/x86_energy_perf_policy/Makefile +1 -1
@@ -9,7 +9,7 @@ ifeq ("$(origin O)", "command line") endif x86_energy_perf_policy : x86_energy_perf_policy.c -override CFLAGS += -Wall +override CFLAGS += -Wall -I../../../include override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' %: %.c