← Documents Documentation/admin-guide/hw-vuln/mds.rst GitHub 원문 ↗

Linux 6.18.37 · Administration / Hardware Vulnerabilities

MDS - Microarchitectural Data Sampling

CPU internal buffer의 speculative sampling, VERW 계열 clearing, SMT·virtualization 완화와 상태 제어를 설명합니다.

Source pathDocumentation/admin-guide/hw-vuln/mds.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

변형과 공격 모델

mds.rst:1-86

영향 CPU, 네 CVE 변형, temporary buffer forwarding과 sampling attack을 설명합니다.

sysfs 상태와 buffer clearing

mds.rst:87-159

best-effort microcode 상태, SMT suffix와 userspace·guest·idle 전환 clearing을 정리합니다.

virtualization과 SMT

mds.rst:160-238

L1TF 상태별 host-to-guest 보호 행렬, XEON PHI와 SMT 요구 사항을 제공합니다.

command line과 선택

mds.rst:239-303

`mds=` option, TAA 상호작용, 신뢰 수준별 지침과 기본값을 설명합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 MDS - Microarchitectural Data Sampling
2 ======================================
3
4 Microarchitectural Data Sampling is a hardware vulnerability which allows
5 unprivileged speculative access to data which is available in various CPU
6 internal buffers.
7
8 Affected processors
9 -------------------
10
11 This vulnerability affects a wide range of Intel processors. The
12 vulnerability is not present on:
13
14 - Processors from AMD, Centaur and other non Intel vendors
15
16 - Older processor models, where the CPU family is < 6
17
18 - Some Atoms (Bonnell, Saltwell, Goldmont, GoldmontPlus)
19
20 - Intel processors which have the ARCH_CAP_MDS_NO bit set in the
21 IA32_ARCH_CAPABILITIES MSR.
22
23 Whether a processor is affected or not can be read out from the MDS
24 vulnerability file in sysfs. See :ref:`mds_sys_info`.
25
26 Not all processors are affected by all variants of MDS, but the mitigation
27 is identical for all of them so the kernel treats them as a single
28 vulnerability.
29
30 Related CVEs
31 ------------
32
33 The following CVE entries are related to the MDS vulnerability:
34
35 ============== ===== ===================================================
36 CVE-2018-12126 MSBDS Microarchitectural Store Buffer Data Sampling
37 CVE-2018-12130 MFBDS Microarchitectural Fill Buffer Data Sampling
38 CVE-2018-12127 MLPDS Microarchitectural Load Port Data Sampling
39 CVE-2019-11091 MDSUM Microarchitectural Data Sampling Uncacheable Memory
40 ============== ===== ===================================================
41
42 Problem
43 -------
44
45 When performing store, load, L1 refill operations, processors write data
46 into temporary microarchitectural structures (buffers). The data in the
47 buffer can be forwarded to load operations as an optimization.
48
49 Under certain conditions, usually a fault/assist caused by a load
50 operation, data unrelated to the load memory address can be speculatively
51 forwarded from the buffers. Because the load operation causes a fault or
52 assist and its result will be discarded, the forwarded data will not cause
53 incorrect program execution or state changes. But a malicious operation
54 may be able to forward this speculative data to a disclosure gadget which
55 allows in turn to infer the value via a cache side channel attack.
56
57 Because the buffers are potentially shared between Hyper-Threads cross
58 Hyper-Thread attacks are possible.
59
60 Deeper technical information is available in the MDS specific x86
61 architecture section: :ref:`Documentation/arch/x86/mds.rst <mds>`.
62
63
64 Attack scenarios
65 ----------------
66
67 Attacks against the MDS vulnerabilities can be mounted from malicious non-
68 privileged user space applications running on hosts or guest. Malicious
69 guest OSes can obviously mount attacks as well.
70
71 Contrary to other speculation based vulnerabilities the MDS vulnerability
72 does not allow the attacker to control the memory target address. As a
73 consequence the attacks are purely sampling based, but as demonstrated with
74 the TLBleed attack samples can be postprocessed successfully.
75
76 Web-Browsers
77 ^^^^^^^^^^^^
78
79 It's unclear whether attacks through Web-Browsers are possible at
80 all. The exploitation through Java-Script is considered very unlikely,
81 but other widely used web technologies like Webassembly could possibly be
82 abused.
83
84
85 .. _mds_sys_info:
86
87 MDS system information
88 -----------------------
89
90 The Linux kernel provides a sysfs interface to enumerate the current MDS
91 status of the system: whether the system is vulnerable, and which
92 mitigations are active. The relevant sysfs file is:
93
94 /sys/devices/system/cpu/vulnerabilities/mds
95
96 The possible values in this file are:
97
98 .. list-table::
99
100 * - 'Not affected'
101 - The processor is not vulnerable
102 * - 'Vulnerable'
103 - The processor is vulnerable, but no mitigation enabled
104 * - 'Vulnerable: Clear CPU buffers attempted, no microcode'
105 - The processor is vulnerable but microcode is not updated. The
106 mitigation is enabled on a best effort basis.
107
108 If the processor is vulnerable but the availability of the microcode
109 based mitigation mechanism is not advertised via CPUID, the kernel
110 selects a best effort mitigation mode. This mode invokes the mitigation
111 instructions without a guarantee that they clear the CPU buffers.
112
113 This is done to address virtualization scenarios where the host has the
114 microcode update applied, but the hypervisor is not yet updated to
115 expose the CPUID to the guest. If the host has updated microcode the
116 protection takes effect; otherwise a few CPU cycles are wasted
117 pointlessly.
118 * - 'Mitigation: Clear CPU buffers'
119 - The processor is vulnerable and the CPU buffer clearing mitigation is
120 enabled.
121
122 If the processor is vulnerable then the following information is appended
123 to the above information:
124
125 ======================== ============================================
126 'SMT vulnerable' SMT is enabled
127 'SMT mitigated' SMT is enabled and mitigated
128 'SMT disabled' SMT is disabled
129 'SMT Host state unknown' Kernel runs in a VM, Host SMT state unknown
130 ======================== ============================================
131
132 Mitigation mechanism
133 -------------------------
134
135 The kernel detects the affected CPUs and the presence of the microcode
136 which is required.
137
138 If a CPU is affected and the microcode is available, then the kernel
139 enables the mitigation by default. The mitigation can be controlled at boot
140 time via a kernel command line option. See
141 :ref:`mds_mitigation_control_command_line`.
142
143 .. _cpu_buffer_clear:
144
145 CPU buffer clearing
146 ^^^^^^^^^^^^^^^^^^^
147
148 The mitigation for MDS clears the affected CPU buffers on return to user
149 space and when entering a guest.
150
151 If SMT is enabled it also clears the buffers on idle entry when the CPU
152 is only affected by MSBDS and not any other MDS variant, because the
153 other variants cannot be protected against cross Hyper-Thread attacks.
154
155 For CPUs which are only affected by MSBDS the user space, guest and idle
156 transition mitigations are sufficient and SMT is not affected.
157
158 .. _virt_mechanism:
159
160 Virtualization mitigation
161 ^^^^^^^^^^^^^^^^^^^^^^^^^
162
163 The protection for host to guest transition depends on the L1TF
164 vulnerability of the CPU:
165
166 - CPU is affected by L1TF:
167
168 If the L1D flush mitigation is enabled and up to date microcode is
169 available, the L1D flush mitigation is automatically protecting the
170 guest transition.
171
172 If the L1D flush mitigation is disabled then the MDS mitigation is
173 invoked explicit when the host MDS mitigation is enabled.
174
175 For details on L1TF and virtualization see:
176 :ref:`Documentation/admin-guide/hw-vuln//l1tf.rst <mitigation_control_kvm>`.
177
178 - CPU is not affected by L1TF:
179
180 CPU buffers are flushed before entering the guest when the host MDS
181 mitigation is enabled.
182
183 The resulting MDS protection matrix for the host to guest transition:
184
185 ============ ===== ============= ============ =================
186 L1TF MDS VMX-L1FLUSH Host MDS MDS-State
187
188 Don't care No Don't care N/A Not affected
189
190 Yes Yes Disabled Off Vulnerable
191
192 Yes Yes Disabled Full Mitigated
193
194 Yes Yes Enabled Don't care Mitigated
195
196 No Yes N/A Off Vulnerable
197
198 No Yes N/A Full Mitigated
199 ============ ===== ============= ============ =================
200
201 This only covers the host to guest transition, i.e. prevents leakage from
202 host to guest, but does not protect the guest internally. Guests need to
203 have their own protections.
204
205 .. _xeon_phi:
206
207 XEON PHI specific considerations
208 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
209
210 The XEON PHI processor family is affected by MSBDS which can be exploited
211 cross Hyper-Threads when entering idle states. Some XEON PHI variants allow
212 to use MWAIT in user space (Ring 3) which opens an potential attack vector
213 for malicious user space. The exposure can be disabled on the kernel
214 command line with the 'ring3mwait=disable' command line option.
215
216 XEON PHI is not affected by the other MDS variants and MSBDS is mitigated
217 before the CPU enters an idle state. As XEON PHI is not affected by L1TF
218 either disabling SMT is not required for full protection.
219
220 .. _mds_smt_control:
221
222 SMT control
223 ^^^^^^^^^^^
224
225 All MDS variants except MSBDS can be attacked cross Hyper-Threads. That
226 means on CPUs which are affected by MFBDS or MLPDS it is necessary to
227 disable SMT for full protection. These are most of the affected CPUs; the
228 exception is XEON PHI, see :ref:`xeon_phi`.
229
230 Disabling SMT can have a significant performance impact, but the impact
231 depends on the type of workloads.
232
233 See the relevant chapter in the L1TF mitigation documentation for details:
234 :ref:`Documentation/admin-guide/hw-vuln/l1tf.rst <smt_control>`.
235
236
237 .. _mds_mitigation_control_command_line:
238
239 Mitigation control on the kernel command line
240 ---------------------------------------------
241
242 The kernel command line allows to control the MDS mitigations at boot
243 time with the option "mds=". The valid arguments for this option are:
244
245 ============ =============================================================
246 full If the CPU is vulnerable, enable all available mitigations
247 for the MDS vulnerability, CPU buffer clearing on exit to
248 userspace and when entering a VM. Idle transitions are
249 protected as well if SMT is enabled.
250
251 It does not automatically disable SMT.
252
253 full,nosmt The same as mds=full, with SMT disabled on vulnerable
254 CPUs. This is the complete mitigation.
255
256 off Disables MDS mitigations completely.
257
258 ============ =============================================================
259
260 Not specifying this option is equivalent to "mds=full". For processors
261 that are affected by both TAA (TSX Asynchronous Abort) and MDS,
262 specifying just "mds=off" without an accompanying "tsx_async_abort=off"
263 will have no effect as the same mitigation is used for both
264 vulnerabilities.
265
266 Mitigation selection guide
267 --------------------------
268
269 1. Trusted userspace
270 ^^^^^^^^^^^^^^^^^^^^
271
272 If all userspace applications are from a trusted source and do not
273 execute untrusted code which is supplied externally, then the mitigation
274 can be disabled.
275
276
277 2. Virtualization with trusted guests
278 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
279
280 The same considerations as above versus trusted user space apply.
281
282 3. Virtualization with untrusted guests
283 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
284
285 The protection depends on the state of the L1TF mitigations.
286 See :ref:`virt_mechanism`.
287
288 If the MDS mitigation is enabled and SMT is disabled, guest to host and
289 guest to guest attacks are prevented.
290
291 .. _mds_default_mitigations:
292
293 Default mitigations
294 -------------------
295
296 The kernel default mitigations for vulnerable processors are:
297
298 - Enable CPU buffer clearing
299
300 The kernel does not by default enforce the disabling of SMT, which leaves
301 SMT systems vulnerable when running untrusted code. The same rationale as
302 for L1TF applies.
303 See :ref:`Documentation/admin-guide/hw-vuln//l1tf.rst <default_mitigations>`.
304

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Microarchitectural Data Sampling 개요

1-7

Microarchitectural Data Sampling(MDS)은 권한 없는 코드가 여러 CPU internal buffer에 있는 데이터에 speculative access할 수 있게 하는 hardware 취약점입니다.

영향받는 프로세서

8-29

MDS는 광범위한 Intel 프로세서에 영향을 줍니다. 다음 프로세서에는 존재하지 않습니다.

  • AMD, Centaur 및 기타 Intel 이외 vendor의 프로세서
  • CPU family가 6보다 작은 오래된 processor model
  • 일부 Atom(Bonnell, Saltwell, Goldmont, GoldmontPlus)
  • `IA32_ARCH_CAPABILITIES` MSR에 `ARCH_CAP_MDS_NO` bit가 설정된 Intel 프로세서

프로세서의 영향 여부는 sysfs의 MDS vulnerability file에서 확인할 수 있습니다. 모든 프로세서가 MDS의 모든 변형에 영향을 받는 것은 아니지만 완화가 동일하므로 커널은 이를 하나의 취약점으로 다룹니다.

관련 CVE와 MDS 변형

30-41
CVE약어이름
CVE-2018-12126MSBDSMicroarchitectural Store Buffer Data Sampling
CVE-2018-12130MFBDSMicroarchitectural Fill Buffer Data Sampling
CVE-2018-12127MLPDSMicroarchitectural Load Port Data Sampling
CVE-2019-11091MDSUMMicroarchitectural Data Sampling Uncacheable Memory

temporary CPU buffer에서의 speculative forwarding

42-63

processor는 store, load, L1 refill 작업을 수행할 때 임시 microarchitectural structure인 buffer에 데이터를 씁니다. 최적화를 위해 buffer의 데이터를 load 작업으로 forwarding할 수 있습니다.

특정 조건, 보통 load가 일으킨 fault 또는 assist에서 load memory address와 무관한 데이터가 buffer로부터 speculative forwarding될 수 있습니다. fault나 assist를 일으킨 load 결과는 폐기되므로 잘못된 program 실행이나 state 변경은 발생하지 않습니다.

그러나 악성 작업이 이 speculative data를 disclosure gadget으로 전달하고 cache side-channel attack으로 값을 추론할 수 있습니다. buffer가 Hyper-Thread 사이에 공유될 수 있으므로 교차 Hyper-Thread 공격도 가능합니다.

더 깊은 기술 정보는 `Documentation/arch/x86/mds.rst`의 `<mds>` 절에 있습니다.

공격 시나리오와 web browser

64-86

host 또는 guest에서 실행되는 악성 non-privileged userspace application이 MDS 취약점을 공격할 수 있으며, 악성 guest OS도 공격할 수 있습니다.

다른 speculation 기반 취약점과 달리 MDS 공격자는 target memory address를 제어할 수 없습니다. 따라서 공격은 순수한 sampling 기반이지만, TLBleed가 보여 준 것처럼 sample을 성공적으로 postprocess할 수 있습니다.

web browser를 통한 공격 가능 여부는 불분명합니다. JavaScript를 통한 악용은 가능성이 매우 낮다고 보지만 WebAssembly 같은 널리 쓰이는 다른 web 기술은 악용될 수 있습니다.

MDS sysfs 상태 정보

87-131

Linux 커널은 system의 MDS 취약 여부와 활성 완화를 다음 sysfs file로 제공합니다.

/sys/devices/system/cpu/vulnerabilities/mds
상태 문자열의미
Not affected프로세서가 취약하지 않습니다.
Vulnerable프로세서가 취약하지만 완화가 활성화되지 않았습니다.
Vulnerable: Clear CPU buffers attempted, no microcode프로세서가 취약하지만 microcode가 업데이트되지 않았습니다. 커널은 best-effort 방식으로 완화 instruction을 실행하지만 CPU buffer가 지워진다는 보장은 없습니다.
Mitigation: Clear CPU buffers프로세서가 취약하며 CPU buffer clearing 완화가 활성화되어 있습니다.

best-effort mode는 host에 microcode update가 적용되었지만 hypervisor가 아직 해당 CPUID를 guest에 노출하지 않는 virtualization 환경을 다룹니다. host microcode가 업데이트되었다면 보호가 작동하고, 아니면 CPU cycle 몇 개만 의미 없이 소비됩니다.

프로세서가 취약하면 다음 SMT 정보가 위 상태 문자열 뒤에 붙습니다.

SMT 상태의미
SMT vulnerableSMT가 활성화되어 있습니다.
SMT mitigatedSMT가 활성화되고 완화되었습니다.
SMT disabledSMT가 비활성화되어 있습니다.
SMT Host state unknown커널이 VM에서 실행되어 host SMT 상태를 알 수 없습니다.

완화 메커니즘과 CPU buffer clearing

132-159

커널은 영향받는 CPU와 필요한 microcode의 존재를 감지합니다. CPU가 영향을 받고 microcode를 사용할 수 있으면 완화를 기본으로 활성화하며 boot time kernel command-line option으로 제어할 수 있습니다.

MDS 완화는 userspace로 돌아갈 때와 guest에 들어갈 때 영향을 받는 CPU buffer를 지웁니다.

SMT가 활성화된 경우 CPU가 MSBDS에만 영향을 받고 다른 MDS 변형에는 영향받지 않을 때 idle 진입에서도 buffer를 지웁니다. 다른 변형은 교차 Hyper-Thread 공격을 이 방식으로 막을 수 없기 때문입니다.

MSBDS에만 영향을 받는 CPU에서는 userspace, guest, idle transition 완화만으로 충분하며 SMT는 취약 상태가 아닙니다.

virtualization 전환 완화

160-206

host-to-guest 전환 보호는 CPU의 L1TF 취약 여부에 따라 달라집니다. CPU가 L1TF의 영향을 받으면 최신 microcode와 L1D flush 완화가 있을 때 L1D flush가 guest 전환도 자동으로 보호합니다. L1D flush가 비활성화되어 있으면 host MDS 완화가 켜진 경우 MDS 완화를 명시적으로 실행합니다.

L1TF 세부 사항은 `Documentation/admin-guide/hw-vuln//l1tf.rst`의 `<mitigation_control_kvm>` 절을 참조하십시오. CPU가 L1TF의 영향을 받지 않으면 host MDS 완화가 활성화된 경우 guest 진입 전에 CPU buffer를 flush합니다.

L1TFMDSVMX-L1FLUSHHost MDSMDS-State
Don't careNoDon't careN/ANot affected
YesYesDisabledOffVulnerable
YesYesDisabledFullMitigated
YesYesEnabledDon't careMitigated
NoYesN/AOffVulnerable
NoYesN/AFullMitigated

이 행렬은 host-to-guest 전환, 즉 host에서 guest로의 누출만 막습니다. guest 내부는 보호하지 않으므로 guest가 자체 보호를 적용해야 합니다.

XEON PHI 특수 고려 사항

207-221

XEON PHI family는 idle state 진입 때 교차 Hyper-Thread로 악용할 수 있는 MSBDS의 영향을 받습니다. 일부 XEON PHI 변형은 userspace(Ring 3)에서 `MWAIT` 사용을 허용해 악성 userspace에 잠재 attack vector를 엽니다.

`ring3mwait=disable` kernel command-line option으로 이 노출을 막을 수 있습니다. XEON PHI는 다른 MDS 변형이나 L1TF의 영향을 받지 않으며 idle 진입 전에 MSBDS를 완화하므로 완전한 보호를 위해 SMT를 끌 필요가 없습니다.

SMT 제어

222-238

MSBDS를 제외한 모든 MDS 변형은 교차 Hyper-Thread로 공격할 수 있습니다. 따라서 MFBDS 또는 MLPDS의 영향을 받는 CPU는 완전한 보호를 위해 SMT를 비활성화해야 합니다. 영향받는 CPU 대부분이 이에 해당하며 예외는 XEON PHI입니다.

SMT 비활성화는 큰 성능 영향을 줄 수 있고 비용은 workload 유형에 따라 달라집니다. 세부 사항은 `Documentation/admin-guide/hw-vuln/l1tf.rst`의 `<smt_control>` 절을 참조하십시오.

mds= kernel command-line 제어

239-265

boot time의 MDS 완화는 `mds=` option으로 제어합니다.

argument동작
fullCPU가 취약하면 사용 가능한 모든 MDS 완화를 활성화합니다. userspace로 나갈 때와 VM 진입 때 CPU buffer를 지우며 SMT가 활성화되어 있으면 idle transition도 보호합니다. SMT를 자동으로 끄지는 않습니다.
full,nosmt`mds=full`과 같으며 취약 CPU에서 SMT도 비활성화합니다. 완전한 완화입니다.
offMDS 완화를 완전히 비활성화합니다.

option을 지정하지 않으면 `mds=full`과 같습니다. TAA(TSX Asynchronous Abort)와 MDS 양쪽의 영향을 받는 프로세서에서는 두 취약점이 같은 완화를 사용하므로 `tsx_async_abort=off` 없이 `mds=off`만 지정해도 효과가 없습니다.

완화 선택 지침

266-292
환경지침
신뢰할 수 있는 userspace모든 userspace application이 신뢰할 수 있는 출처에서 왔고 외부에서 공급된 untrusted code를 실행하지 않으면 완화를 끌 수 있습니다.
신뢰할 수 있는 guest와 virtualization신뢰할 수 있는 userspace와 같은 판단 기준을 적용합니다.
신뢰할 수 없는 guest와 virtualization보호 수준은 L1TF 완화 상태에 따라 달라집니다. MDS 완화가 활성화되고 SMT가 비활성화되어 있으면 guest-to-host와 guest-to-guest 공격을 막습니다.

기본 완화

293-303

취약한 프로세서에서 커널은 기본적으로 다음을 적용합니다.

  • CPU buffer clearing을 활성화합니다.

커널은 SMT 비활성화를 기본으로 강제하지 않으므로 untrusted code를 실행하는 SMT system은 취약한 상태로 남습니다. 선택 근거는 L1TF와 동일하며 `Documentation/admin-guide/hw-vuln//l1tf.rst`의 `<default_mitigations>` 절을 참조하십시오.