요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
SMT 제한
l1d_flush.rst:57-69sibling thread 동시 실행은 보호하지 못하며 잘못 배치된 opt-in task에는 `SIGBUS`가 전달됩니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
L1D Flushing
============
With an increasing number of vulnerabilities being reported around data
leaks from the Level 1 Data cache (L1D) the kernel provides an opt-in
mechanism to flush the L1D cache on context switch.
This mechanism can be used to address e.g. CVE-2020-0550. For applications
the mechanism keeps them safe from vulnerabilities, related to leaks
(snooping of) from the L1D cache.
Related CVEs
------------
The following CVEs can be addressed by this
mechanism
============= ======================== ==================
CVE-2020-0550 Improper Data Forwarding OS related aspects
============= ======================== ==================
Usage Guidelines
----------------
Please see document: :ref:`Documentation/userspace-api/spec_ctrl.rst
<set_spec_ctrl>` for details.
**NOTE**: The feature is disabled by default, applications need to
specifically opt into the feature to enable it.
Mitigation
----------
When PR_SET_L1D_FLUSH is enabled for a task a flush of the L1D cache is
performed when the task is scheduled out and the incoming task belongs to a
different process and therefore to a different address space.
If the underlying CPU supports L1D flushing in hardware, the hardware
mechanism is used, software fallback for the mitigation, is not supported.
Mitigation control on the kernel command line
---------------------------------------------
The kernel command line allows to control the L1D flush mitigations at boot
time with the option "l1d_flush=". The valid arguments for this option are:
============ =============================================================
on Enables the prctl interface, applications trying to use
the prctl() will fail with an error if l1d_flush is not
enabled
============ =============================================================
By default the mechanism is disabled.
Limitations
-----------
The mechanism does not mitigate L1D data leaks between tasks belonging to
different processes which are concurrently executing on sibling threads of
a physical CPU core when SMT is enabled on the system.
This can be addressed by controlled placement of processes on physical CPU
cores or by disabling SMT. See the relevant chapter in the L1TF mitigation
document: :ref:`Documentation/admin-guide/hw-vuln/l1tf.rst <smt_control>`.
**NOTE** : The opt-in of a task for L1D flushing works only when the task's
affinity is limited to cores running in non-SMT mode. If a task which
requested L1D flushing is scheduled on a SMT-enabled core the kernel sends
a SIGBUS to the task.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
L1D flushing 개요
1-11Level 1 Data cache(L1D)의 데이터 누출과 관련된 취약점 보고가 늘어남에 따라 커널은 context switch 때 L1D cache를 flush하는 opt-in 메커니즘을 제공합니다.
이 메커니즘은 예를 들어 `CVE-2020-0550`을 다룰 수 있습니다. application 관점에서는 L1D cache를 엿보아 데이터가 누출되는 종류의 취약점으로부터 application을 보호합니다.
관련 CVE
12-22| CVE | 문제 | 범위 |
|---|---|---|
| CVE-2020-0550 | Improper Data Forwarding | OS related aspects |
사용 지침
23-31자세한 내용은 `Documentation/userspace-api/spec_ctrl.rst`의 `<set_spec_ctrl>` 절을 참조하십시오.
이 기능은 기본으로 비활성화되어 있습니다. application이 명시적으로 opt in해야 활성화됩니다.
완화 동작
32-42task에 `PR_SET_L1D_FLUSH`가 활성화되어 있으면, 그 task가 schedule out되고 들어오는 task가 다른 process, 즉 다른 address space에 속할 때 L1D cache를 flush합니다.
기반 CPU가 hardware L1D flushing을 지원하면 hardware 메커니즘을 사용합니다. 이 완화를 위한 software fallback은 지원하지 않습니다.
kernel command line 제어
43-56boot time의 L1D flush 완화는 `l1d_flush=` kernel command-line option으로 제어합니다.
| argument | 동작 |
|---|---|
| on | `prctl` interface를 활성화합니다. `l1d_flush`가 활성화되지 않은 상태에서 application이 `prctl()`을 사용하면 error로 실패합니다. |
기본적으로 이 메커니즘은 비활성화되어 있습니다.
SMT 환경의 제한
57-69system에서 SMT가 활성화되어 있을 때 물리 CPU core의 sibling thread에서 서로 다른 process의 task가 동시에 실행되면, 이 메커니즘은 task 사이의 L1D 데이터 누출을 완화하지 못합니다.
process를 물리 CPU core에 통제된 방식으로 배치하거나 SMT를 비활성화해 이 문제를 다룰 수 있습니다. `Documentation/admin-guide/hw-vuln/l1tf.rst`의 `<smt_control>` 절을 참조하십시오.
task의 L1D flushing opt-in은 해당 task의 affinity가 non-SMT mode로 실행되는 core로 제한된 경우에만 동작합니다. L1D flushing을 요청한 task가 SMT-enabled core에 schedule되면 커널은 그 task에 `SIGBUS`를 보냅니다.
opt-in 완화
l1d_flush.rst:1-56`PR_SET_L1D_FLUSH`와 `l1d_flush=on`으로 process address-space 전환 시 L1D를 지우는 동작을 설명합니다.