요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
상태와 열거
multihit.rst:67-105sysfs 상태와 `PSCHANGE_MC_NO` bit 판정을 제공합니다.
KVM 완화와 선택
multihit.rst:106-167non-executable huge page 분할, `nx_huge_pages=` 제어와 신뢰 수준별 지침을 설명합니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
iTLB multihit
=============
iTLB multihit is an erratum where some processors may incur a machine check
error, possibly resulting in an unrecoverable CPU lockup, when an
instruction fetch hits multiple entries in the instruction TLB. This can
occur when the page size is changed along with either the physical address
or cache type. A malicious guest running on a virtualized system can
exploit this erratum to perform a denial of service attack.
Affected processors
-------------------
Variations of this erratum are present on most Intel Core and Xeon processor
models. The erratum is not present on:
- non-Intel processors
- Some Atoms (Airmont, Bonnell, Goldmont, GoldmontPlus, Saltwell, Silvermont)
- Intel processors that have the PSCHANGE_MC_NO bit set in the
IA32_ARCH_CAPABILITIES MSR.
Related CVEs
------------
The following CVE entry is related to this issue:
============== =================================================
CVE-2018-12207 Machine Check Error Avoidance on Page Size Change
============== =================================================
Problem
-------
Privileged software, including OS and virtual machine managers (VMM), are in
charge of memory management. A key component in memory management is the control
of the page tables. Modern processors use virtual memory, a technique that creates
the illusion of a very large memory for processors. This virtual space is split
into pages of a given size. Page tables translate virtual addresses to physical
addresses.
To reduce latency when performing a virtual to physical address translation,
processors include a structure, called TLB, that caches recent translations.
There are separate TLBs for instruction (iTLB) and data (dTLB).
Under this errata, instructions are fetched from a linear address translated
using a 4 KB translation cached in the iTLB. Privileged software modifies the
paging structure so that the same linear address using large page size (2 MB, 4
MB, 1 GB) with a different physical address or memory type. After the page
structure modification but before the software invalidates any iTLB entries for
the linear address, a code fetch that happens on the same linear address may
cause a machine-check error which can result in a system hang or shutdown.
Attack scenarios
----------------
Attacks against the iTLB multihit erratum can be mounted from malicious
guests in a virtualized system.
iTLB multihit system information
--------------------------------
The Linux kernel provides a sysfs interface to enumerate the current iTLB
multihit status of the system:whether the system is vulnerable and which
mitigations are active. The relevant sysfs file is:
/sys/devices/system/cpu/vulnerabilities/itlb_multihit
The possible values in this file are:
.. list-table::
* - Not affected
- The processor is not vulnerable.
* - KVM: Mitigation: Split huge pages
- Software changes mitigate this issue.
* - KVM: Mitigation: VMX unsupported
- KVM is not vulnerable because Virtual Machine Extensions (VMX) is not supported.
* - KVM: Mitigation: VMX disabled
- KVM is not vulnerable because Virtual Machine Extensions (VMX) is disabled.
* - KVM: Vulnerable
- The processor is vulnerable, but no mitigation enabled
Enumeration of the erratum
--------------------------------
A new bit has been allocated in the IA32_ARCH_CAPABILITIES (PSCHANGE_MC_NO) msr
and will be set on CPU's which are mitigated against this issue.
======================================= =========== ===============================
IA32_ARCH_CAPABILITIES MSR Not present Possibly vulnerable,check model
IA32_ARCH_CAPABILITIES[PSCHANGE_MC_NO] '0' Likely vulnerable,check model
IA32_ARCH_CAPABILITIES[PSCHANGE_MC_NO] '1' Not vulnerable
======================================= =========== ===============================
Mitigation mechanism
-------------------------
This erratum can be mitigated by restricting the use of large page sizes to
non-executable pages. This forces all iTLB entries to be 4K, and removes
the possibility of multiple hits.
In order to mitigate the vulnerability, KVM initially marks all huge pages
as non-executable. If the guest attempts to execute in one of those pages,
the page is broken down into 4K pages, which are then marked executable.
If EPT is disabled or not available on the host, KVM is in control of TLB
flushes and the problematic situation cannot happen. However, the shadow
EPT paging mechanism used by nested virtualization is vulnerable, because
the nested guest can trigger multiple iTLB hits by modifying its own
(non-nested) page tables. For simplicity, KVM will make large pages
non-executable in all shadow paging modes.
Mitigation control on the kernel command line and KVM - module parameter
------------------------------------------------------------------------
The KVM hypervisor mitigation mechanism for marking huge pages as
non-executable can be controlled with a module parameter "nx_huge_pages=".
The kernel command line allows to control the iTLB multihit mitigations at
boot time with the option "kvm.nx_huge_pages=".
The valid arguments for these options are:
========== ================================================================
force Mitigation is enabled. In this case, the mitigation implements
non-executable huge pages in Linux kernel KVM module. All huge
pages in the EPT are marked as non-executable.
If a guest attempts to execute in one of those pages, the page is
broken down into 4K pages, which are then marked executable.
off Mitigation is disabled.
auto Enable mitigation only if the platform is affected and the kernel
was not booted with the "mitigations=off" command line parameter.
This is the default option.
========== ================================================================
Mitigation selection guide
--------------------------
1. No virtualization in use
^^^^^^^^^^^^^^^^^^^^^^^^^^^
The system is protected by the kernel unconditionally and no further
action is required.
2. Virtualization with trusted guests
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If the guest comes from a trusted source, you may assume that the guest will
not attempt to maliciously exploit these errata and no further action is
required.
3. Virtualization with untrusted guests
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If the guest comes from an untrusted source, the guest host kernel will need
to apply iTLB multihit mitigation via the kernel command line or kvm
module parameter.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
iTLB multihit 개요
1-11iTLB multihit는 instruction fetch가 instruction TLB의 여러 entry에 동시에 hit할 때 일부 프로세서에서 machine-check error가 발생할 수 있는 erratum입니다. 복구할 수 없는 CPU lockup으로 이어질 수도 있습니다.
page size를 physical address 또는 cache type과 함께 바꿀 때 이 문제가 발생할 수 있습니다. virtualized system의 악의적인 guest는 이 erratum을 악용해 denial-of-service 공격을 수행할 수 있습니다.
영향받는 프로세서와 CVE
12-28이 erratum의 변형은 대부분의 Intel Core 및 Xeon processor model에 존재합니다. 다음에는 존재하지 않습니다.
- Intel이 아닌 프로세서
- 일부 Atom(Airmont, Bonnell, Goldmont, GoldmontPlus, Saltwell, Silvermont)
- `IA32_ARCH_CAPABILITIES` MSR에 `PSCHANGE_MC_NO` bit가 설정된 Intel 프로세서
| CVE | 관련 문제 |
|---|---|
| CVE-2018-12207 | Machine Check Error Avoidance on Page Size Change |
page-size 변경과 다중 iTLB hit
29-58OS와 virtual machine manager(VMM)를 포함한 privileged software가 memory management를 담당하며, page table 제어는 그 핵심입니다. modern processor의 virtual memory는 큰 memory 공간처럼 보이는 address space를 일정 크기의 page로 나누고, page table로 virtual address를 physical address에 대응시킵니다.
processor는 virtual-to-physical address translation 지연을 줄이기 위해 최근 translation을 cache하는 TLB를 사용합니다. instruction용 iTLB와 data용 dTLB는 분리되어 있습니다.
이 erratum에서는 4 KB translation이 iTLB에 cache된 linear address에서 instruction을 fetch하는 동안 privileged software가 paging structure를 변경해 같은 linear address가 다른 physical address 또는 memory type의 large page(2 MB, 4 MB, 1 GB)를 사용하게 만듭니다.
page structure를 바꾼 뒤 software가 해당 linear address의 iTLB entry를 invalidate하기 전에 같은 address에서 code fetch가 일어나면 machine-check error가 발생해 system hang 또는 shutdown으로 이어질 수 있습니다.
공격 시나리오
59-66virtualized system의 악의적인 guest가 iTLB multihit erratum을 이용해 공격할 수 있습니다.
iTLB multihit system 정보
67-91Linux 커널은 system이 취약한지와 어떤 완화가 활성화되었는지를 다음 sysfs file로 제공합니다.
/sys/devices/system/cpu/vulnerabilities/itlb_multihit
| 상태 문자열 | 의미 |
|---|---|
| Not affected | 프로세서가 취약하지 않습니다. |
| KVM: Mitigation: Split huge pages | software 변경으로 문제를 완화합니다. |
| KVM: Mitigation: VMX unsupported | Virtual Machine Extensions(VMX)를 지원하지 않아 KVM이 취약하지 않습니다. |
| KVM: Mitigation: VMX disabled | VMX가 비활성화되어 KVM이 취약하지 않습니다. |
| KVM: Vulnerable | 프로세서가 취약하지만 완화가 활성화되지 않았습니다. |
erratum 열거
92-105`IA32_ARCH_CAPABILITIES` MSR에 새 `PSCHANGE_MC_NO` bit가 할당되며, 이 문제에 대한 완화가 적용된 CPU에서 설정됩니다.
| 조건 | 값 | 판정 |
|---|---|---|
| IA32_ARCH_CAPABILITIES MSR | Not present | 취약할 수 있으므로 model을 확인합니다. |
| IA32_ARCH_CAPABILITIES[PSCHANGE_MC_NO] | 0 | 취약할 가능성이 높으므로 model을 확인합니다. |
| IA32_ARCH_CAPABILITIES[PSCHANGE_MC_NO] | 1 | 취약하지 않습니다. |
huge page 분할 완화
106-127large page size의 사용을 non-executable page로 제한하면 이 erratum을 완화할 수 있습니다. 그러면 모든 iTLB entry가 4K가 되어 multiple hit 가능성이 사라집니다.
KVM은 처음에 모든 huge page를 non-executable로 표시합니다. guest가 그 page에서 실행하려 하면 해당 page를 4K page로 쪼갠 뒤 executable로 표시합니다.
host에서 EPT가 비활성화되었거나 사용할 수 없으면 KVM이 TLB flush를 제어하므로 문제가 되는 상황이 발생하지 않습니다. 하지만 nested virtualization의 shadow EPT paging은 nested guest가 자신의 non-nested page table을 바꾸어 여러 iTLB hit를 일으킬 수 있으므로 취약합니다. 단순성을 위해 KVM은 모든 shadow paging mode에서 large page를 non-executable로 만듭니다.
KVM module parameter와 command line
128-153huge page를 non-executable로 표시하는 KVM 완화는 `nx_huge_pages=` module parameter로 제어합니다. boot time에는 `kvm.nx_huge_pages=` kernel command-line option을 사용합니다.
| argument | 동작 |
|---|---|
| force | 완화를 활성화합니다. KVM의 EPT에 있는 모든 huge page를 non-executable로 표시하며 guest가 실행하려 하면 4K page로 분할한 뒤 executable로 표시합니다. |
| off | 완화를 비활성화합니다. |
| auto | platform이 영향을 받고 kernel이 `mitigations=off`로 boot되지 않은 경우에만 완화를 켭니다. 기본 option입니다. |
완화 선택 지침
154-167| 환경 | 지침 |
|---|---|
| virtualization을 사용하지 않음 | kernel이 무조건 system을 보호하므로 추가 조치가 필요 없습니다. |
| 신뢰할 수 있는 guest와 virtualization 사용 | guest가 악의적으로 erratum을 악용하지 않는다고 가정할 수 있어 추가 조치가 필요 없습니다. |
| 신뢰할 수 없는 guest와 virtualization 사용 | guest host kernel이 kernel command line 또는 KVM module parameter로 iTLB multihit 완화를 적용해야 합니다. |
erratum과 공격 모델
multihit.rst:1-66영향 CPU, CVE와 4 KB·large-page translation이 겹치는 machine-check 조건을 정리합니다.