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

Linux 6.18.37 · Administration / Hardware Vulnerabilities

iTLB multihit

page-size 변경 중 iTLB 다중 hit가 일으키는 machine check와 KVM huge-page 분할 완화를 설명합니다.

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

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

1. 요약·해설

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

erratum과 공격 모델

multihit.rst:1-66

영향 CPU, CVE와 4 KB·large-page translation이 겹치는 machine-check 조건을 정리합니다.

상태와 열거

multihit.rst:67-105

sysfs 상태와 `PSCHANGE_MC_NO` bit 판정을 제공합니다.

KVM 완화와 선택

multihit.rst:106-167

non-executable huge page 분할, `nx_huge_pages=` 제어와 신뢰 수준별 지침을 설명합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 iTLB multihit
2 =============
3
4 iTLB multihit is an erratum where some processors may incur a machine check
5 error, possibly resulting in an unrecoverable CPU lockup, when an
6 instruction fetch hits multiple entries in the instruction TLB. This can
7 occur when the page size is changed along with either the physical address
8 or cache type. A malicious guest running on a virtualized system can
9 exploit this erratum to perform a denial of service attack.
10
11
12 Affected processors
13 -------------------
14
15 Variations of this erratum are present on most Intel Core and Xeon processor
16 models. The erratum is not present on:
17
18 - non-Intel processors
19
20 - Some Atoms (Airmont, Bonnell, Goldmont, GoldmontPlus, Saltwell, Silvermont)
21
22 - Intel processors that have the PSCHANGE_MC_NO bit set in the
23 IA32_ARCH_CAPABILITIES MSR.
24
25
26 Related CVEs
27 ------------
28
29 The following CVE entry is related to this issue:
30
31 ============== =================================================
32 CVE-2018-12207 Machine Check Error Avoidance on Page Size Change
33 ============== =================================================
34
35
36 Problem
37 -------
38
39 Privileged software, including OS and virtual machine managers (VMM), are in
40 charge of memory management. A key component in memory management is the control
41 of the page tables. Modern processors use virtual memory, a technique that creates
42 the illusion of a very large memory for processors. This virtual space is split
43 into pages of a given size. Page tables translate virtual addresses to physical
44 addresses.
45
46 To reduce latency when performing a virtual to physical address translation,
47 processors include a structure, called TLB, that caches recent translations.
48 There are separate TLBs for instruction (iTLB) and data (dTLB).
49
50 Under this errata, instructions are fetched from a linear address translated
51 using a 4 KB translation cached in the iTLB. Privileged software modifies the
52 paging structure so that the same linear address using large page size (2 MB, 4
53 MB, 1 GB) with a different physical address or memory type. After the page
54 structure modification but before the software invalidates any iTLB entries for
55 the linear address, a code fetch that happens on the same linear address may
56 cause a machine-check error which can result in a system hang or shutdown.
57
58
59 Attack scenarios
60 ----------------
61
62 Attacks against the iTLB multihit erratum can be mounted from malicious
63 guests in a virtualized system.
64
65
66 iTLB multihit system information
67 --------------------------------
68
69 The Linux kernel provides a sysfs interface to enumerate the current iTLB
70 multihit status of the system:whether the system is vulnerable and which
71 mitigations are active. The relevant sysfs file is:
72
73 /sys/devices/system/cpu/vulnerabilities/itlb_multihit
74
75 The possible values in this file are:
76
77 .. list-table::
78
79 * - Not affected
80 - The processor is not vulnerable.
81 * - KVM: Mitigation: Split huge pages
82 - Software changes mitigate this issue.
83 * - KVM: Mitigation: VMX unsupported
84 - KVM is not vulnerable because Virtual Machine Extensions (VMX) is not supported.
85 * - KVM: Mitigation: VMX disabled
86 - KVM is not vulnerable because Virtual Machine Extensions (VMX) is disabled.
87 * - KVM: Vulnerable
88 - The processor is vulnerable, but no mitigation enabled
89
90
91 Enumeration of the erratum
92 --------------------------------
93
94 A new bit has been allocated in the IA32_ARCH_CAPABILITIES (PSCHANGE_MC_NO) msr
95 and will be set on CPU's which are mitigated against this issue.
96
97 ======================================= =========== ===============================
98 IA32_ARCH_CAPABILITIES MSR Not present Possibly vulnerable,check model
99 IA32_ARCH_CAPABILITIES[PSCHANGE_MC_NO] '0' Likely vulnerable,check model
100 IA32_ARCH_CAPABILITIES[PSCHANGE_MC_NO] '1' Not vulnerable
101 ======================================= =========== ===============================
102
103
104 Mitigation mechanism
105 -------------------------
106
107 This erratum can be mitigated by restricting the use of large page sizes to
108 non-executable pages. This forces all iTLB entries to be 4K, and removes
109 the possibility of multiple hits.
110
111 In order to mitigate the vulnerability, KVM initially marks all huge pages
112 as non-executable. If the guest attempts to execute in one of those pages,
113 the page is broken down into 4K pages, which are then marked executable.
114
115 If EPT is disabled or not available on the host, KVM is in control of TLB
116 flushes and the problematic situation cannot happen. However, the shadow
117 EPT paging mechanism used by nested virtualization is vulnerable, because
118 the nested guest can trigger multiple iTLB hits by modifying its own
119 (non-nested) page tables. For simplicity, KVM will make large pages
120 non-executable in all shadow paging modes.
121
122 Mitigation control on the kernel command line and KVM - module parameter
123 ------------------------------------------------------------------------
124
125 The KVM hypervisor mitigation mechanism for marking huge pages as
126 non-executable can be controlled with a module parameter "nx_huge_pages=".
127 The kernel command line allows to control the iTLB multihit mitigations at
128 boot time with the option "kvm.nx_huge_pages=".
129
130 The valid arguments for these options are:
131
132 ========== ================================================================
133 force Mitigation is enabled. In this case, the mitigation implements
134 non-executable huge pages in Linux kernel KVM module. All huge
135 pages in the EPT are marked as non-executable.
136 If a guest attempts to execute in one of those pages, the page is
137 broken down into 4K pages, which are then marked executable.
138
139 off Mitigation is disabled.
140
141 auto Enable mitigation only if the platform is affected and the kernel
142 was not booted with the "mitigations=off" command line parameter.
143 This is the default option.
144 ========== ================================================================
145
146
147 Mitigation selection guide
148 --------------------------
149
150 1. No virtualization in use
151 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
152
153 The system is protected by the kernel unconditionally and no further
154 action is required.
155
156 2. Virtualization with trusted guests
157 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
158
159 If the guest comes from a trusted source, you may assume that the guest will
160 not attempt to maliciously exploit these errata and no further action is
161 required.
162
163 3. Virtualization with untrusted guests
164 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
165 If the guest comes from an untrusted source, the guest host kernel will need
166 to apply iTLB multihit mitigation via the kernel command line or kvm
167 module parameter.
168

3. 한국어 전문 번역

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

iTLB multihit 개요

1-11

iTLB 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-12207Machine Check Error Avoidance on Page Size Change

page-size 변경과 다중 iTLB hit

29-58

OS와 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-66

virtualized system의 악의적인 guest가 iTLB multihit erratum을 이용해 공격할 수 있습니다.

iTLB multihit system 정보

67-91

Linux 커널은 system이 취약한지와 어떤 완화가 활성화되었는지를 다음 sysfs file로 제공합니다.

/sys/devices/system/cpu/vulnerabilities/itlb_multihit
상태 문자열의미
Not affected프로세서가 취약하지 않습니다.
KVM: Mitigation: Split huge pagessoftware 변경으로 문제를 완화합니다.
KVM: Mitigation: VMX unsupportedVirtual Machine Extensions(VMX)를 지원하지 않아 KVM이 취약하지 않습니다.
KVM: Mitigation: VMX disabledVMX가 비활성화되어 KVM이 취약하지 않습니다.
KVM: Vulnerable프로세서가 취약하지만 완화가 활성화되지 않았습니다.

erratum 열거

92-105

`IA32_ARCH_CAPABILITIES` MSR에 새 `PSCHANGE_MC_NO` bit가 할당되며, 이 문제에 대한 완화가 적용된 CPU에서 설정됩니다.

조건판정
IA32_ARCH_CAPABILITIES MSRNot present취약할 수 있으므로 model을 확인합니다.
IA32_ARCH_CAPABILITIES[PSCHANGE_MC_NO]0취약할 가능성이 높으므로 model을 확인합니다.
IA32_ARCH_CAPABILITIES[PSCHANGE_MC_NO]1취약하지 않습니다.

huge page 분할 완화

106-127

large 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-153

huge 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완화를 비활성화합니다.
autoplatform이 영향을 받고 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 완화를 적용해야 합니다.