요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
sysfs 상태와 buffer clearing
mds.rst:87-159best-effort microcode 상태, SMT suffix와 userspace·guest·idle 전환 clearing을 정리합니다.
virtualization과 SMT
mds.rst:160-238L1TF 상태별 host-to-guest 보호 행렬, XEON PHI와 SMT 요구 사항을 제공합니다.
command line과 선택
mds.rst:239-303`mds=` option, TAA 상호작용, 신뢰 수준별 지침과 기본값을 설명합니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
MDS - Microarchitectural Data Sampling
======================================
Microarchitectural Data Sampling is a hardware vulnerability which allows
unprivileged speculative access to data which is available in various CPU
internal buffers.
Affected processors
-------------------
This vulnerability affects a wide range of Intel processors. The
vulnerability is not present on:
- Processors from AMD, Centaur and other non Intel vendors
- Older processor models, where the CPU family is < 6
- Some Atoms (Bonnell, Saltwell, Goldmont, GoldmontPlus)
- Intel processors which have the ARCH_CAP_MDS_NO bit set in the
IA32_ARCH_CAPABILITIES MSR.
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
------------
The following CVE entries are related to the MDS vulnerability:
============== ===== ===================================================
CVE-2018-12126 MSBDS Microarchitectural Store Buffer Data Sampling
CVE-2018-12130 MFBDS Microarchitectural Fill Buffer Data Sampling
CVE-2018-12127 MLPDS Microarchitectural Load Port Data Sampling
CVE-2019-11091 MDSUM Microarchitectural Data Sampling Uncacheable Memory
============== ===== ===================================================
Problem
-------
When performing store, load, L1 refill operations, processors write data
into temporary microarchitectural structures (buffers). The data in the
buffer can be forwarded to load operations as an optimization.
Under certain conditions, usually a fault/assist caused by a load
operation, data unrelated to the load memory address can be speculatively
forwarded from the buffers. Because the load operation causes a fault or
assist and its result will be discarded, the forwarded data will not cause
incorrect program execution or state changes. But a malicious operation
may be able to forward this speculative data to a disclosure gadget which
allows in turn to infer the value via a cache side channel attack.
Because the buffers are potentially shared between Hyper-Threads cross
Hyper-Thread attacks are possible.
Deeper technical information is available in the MDS specific x86
architecture section: :ref:`Documentation/arch/x86/mds.rst <mds>`.
Attack scenarios
----------------
Attacks against the MDS vulnerabilities can be mounted from malicious non-
privileged user space applications running on hosts or guest. Malicious
guest OSes can obviously mount attacks as well.
Contrary to other speculation based vulnerabilities the MDS vulnerability
does not allow the attacker to control the memory target address. As a
consequence the attacks are purely sampling based, but as demonstrated with
the TLBleed attack samples can be postprocessed successfully.
Web-Browsers
^^^^^^^^^^^^
It's unclear whether attacks through Web-Browsers are possible at
all. The exploitation through Java-Script is considered very unlikely,
but other widely used web technologies like Webassembly could possibly be
abused.
.. _mds_sys_info:
MDS system information
-----------------------
The Linux kernel provides a sysfs interface to enumerate the current MDS
status of the system: whether the system is vulnerable, and which
mitigations are active. The relevant sysfs file is:
/sys/devices/system/cpu/vulnerabilities/mds
The possible values in this file are:
.. list-table::
* - 'Not affected'
- The processor is not vulnerable
* - 'Vulnerable'
- The processor is vulnerable, but no mitigation enabled
* - 'Vulnerable: Clear CPU buffers attempted, no microcode'
- The processor is vulnerable but microcode is not updated. The
mitigation is enabled on a best effort basis.
If the processor is vulnerable but the availability of the microcode
based mitigation mechanism is not advertised via CPUID, the kernel
selects a best effort mitigation mode. This mode invokes the mitigation
instructions without a guarantee that they clear the CPU buffers.
This is done to address virtualization scenarios where the host has the
microcode update applied, but the hypervisor is not yet updated to
expose the CPUID to the guest. If the host has updated microcode the
protection takes effect; otherwise a few CPU cycles are wasted
pointlessly.
* - 'Mitigation: Clear CPU buffers'
- The processor is vulnerable and the CPU buffer clearing mitigation is
enabled.
If the processor is vulnerable then the following information is appended
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
======================== ============================================
Mitigation mechanism
-------------------------
The kernel detects the affected CPUs and the presence of the microcode
which is required.
If a CPU is affected and the microcode is available, then the kernel
enables the mitigation by default. The mitigation can be controlled at boot
time via a kernel command line option. See
:ref:`mds_mitigation_control_command_line`.
.. _cpu_buffer_clear:
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 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:
Virtualization mitigation
^^^^^^^^^^^^^^^^^^^^^^^^^
The protection for host to guest transition depends on the L1TF
vulnerability of the CPU:
- CPU is affected by L1TF:
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 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>`.
- CPU is not affected by L1TF:
CPU buffers are flushed before entering the guest when the host MDS
mitigation is enabled.
The resulting MDS protection matrix for the host to guest transition:
============ ===== ============= ============ =================
L1TF MDS VMX-L1FLUSH Host MDS MDS-State
Don't care No Don't care N/A Not affected
Yes Yes Disabled Off Vulnerable
Yes Yes Disabled Full Mitigated
Yes Yes Enabled Don't care Mitigated
No Yes N/A Off Vulnerable
No Yes N/A Full Mitigated
============ ===== ============= ============ =================
This only covers the host to guest transition, i.e. prevents leakage from
host to guest, but does not protect the guest internally. Guests need to
have their own protections.
.. _xeon_phi:
XEON PHI specific considerations
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The XEON PHI processor family is affected by MSBDS which can be exploited
cross Hyper-Threads when entering idle states. Some XEON PHI variants allow
to use MWAIT in user space (Ring 3) which opens an potential attack vector
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 an idle state. As XEON PHI is not affected by L1TF
either disabling SMT is not required for full protection.
.. _mds_smt_control:
SMT control
^^^^^^^^^^^
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>`.
.. _mds_mitigation_control_command_line:
Mitigation control on the kernel command line
---------------------------------------------
The kernel command line allows to control the MDS mitigations at boot
time with the option "mds=". The valid arguments for this option are:
============ =============================================================
full If the CPU is vulnerable, enable all available mitigations
for the MDS vulnerability, CPU buffer clearing on exit to
userspace and when entering a VM. Idle transitions are
protected as well if SMT is enabled.
It does not automatically disable SMT.
full,nosmt The same as mds=full, with SMT disabled on vulnerable
CPUs. This is the complete mitigation.
off Disables MDS mitigations completely.
============ =============================================================
Not specifying this option is equivalent to "mds=full". For processors
that are affected by both TAA (TSX Asynchronous Abort) and MDS,
specifying just "mds=off" without an accompanying "tsx_async_abort=off"
will have no effect as the same mitigation is used for both
vulnerabilities.
Mitigation selection guide
--------------------------
1. Trusted userspace
^^^^^^^^^^^^^^^^^^^^
If all userspace applications are from a trusted source and do not
execute untrusted code which is supplied externally, then the mitigation
can be disabled.
2. Virtualization with trusted guests
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The same considerations as above versus trusted user space apply.
3. Virtualization with untrusted guests
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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:
Default mitigations
-------------------
The kernel default mitigations for vulnerable processors are:
- Enable CPU buffer clearing
The kernel does not by default enforce the disabling of SMT, which leaves
SMT systems vulnerable when running untrusted code. The same rationale as
for L1TF applies.
See :ref:`Documentation/admin-guide/hw-vuln//l1tf.rst <default_mitigations>`.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Microarchitectural Data Sampling 개요
1-7Microarchitectural Data Sampling(MDS)은 권한 없는 코드가 여러 CPU internal buffer에 있는 데이터에 speculative access할 수 있게 하는 hardware 취약점입니다.
영향받는 프로세서
8-29MDS는 광범위한 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-12126 | MSBDS | Microarchitectural Store Buffer Data Sampling |
| CVE-2018-12130 | MFBDS | Microarchitectural Fill Buffer Data Sampling |
| CVE-2018-12127 | MLPDS | Microarchitectural Load Port Data Sampling |
| CVE-2019-11091 | MDSUM | Microarchitectural Data Sampling Uncacheable Memory |
temporary CPU buffer에서의 speculative forwarding
42-63processor는 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-86host 또는 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-131Linux 커널은 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 vulnerable | SMT가 활성화되어 있습니다. |
| SMT mitigated | SMT가 활성화되고 완화되었습니다. |
| SMT disabled | SMT가 비활성화되어 있습니다. |
| 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-206host-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합니다.
| L1TF | MDS | VMX-L1FLUSH | Host MDS | MDS-State |
|---|---|---|---|---|
| Don't care | No | Don't care | N/A | Not affected |
| Yes | Yes | Disabled | Off | Vulnerable |
| Yes | Yes | Disabled | Full | Mitigated |
| Yes | Yes | Enabled | Don't care | Mitigated |
| No | Yes | N/A | Off | Vulnerable |
| No | Yes | N/A | Full | Mitigated |
이 행렬은 host-to-guest 전환, 즉 host에서 guest로의 누출만 막습니다. guest 내부는 보호하지 않으므로 guest가 자체 보호를 적용해야 합니다.
XEON PHI 특수 고려 사항
207-221XEON 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-238MSBDS를 제외한 모든 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-265boot time의 MDS 완화는 `mds=` option으로 제어합니다.
| argument | 동작 |
|---|---|
| full | CPU가 취약하면 사용 가능한 모든 MDS 완화를 활성화합니다. userspace로 나갈 때와 VM 진입 때 CPU buffer를 지우며 SMT가 활성화되어 있으면 idle transition도 보호합니다. SMT를 자동으로 끄지는 않습니다. |
| full,nosmt | `mds=full`과 같으며 취약 CPU에서 SMT도 비활성화합니다. 완전한 완화입니다. |
| off | MDS 완화를 완전히 비활성화합니다. |
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>` 절을 참조하십시오.
변형과 공격 모델
mds.rst:1-86영향 CPU, 네 CVE 변형, temporary buffer forwarding과 sampling attack을 설명합니다.