168 lines · plain
1iTLB multihit2=============3 4iTLB multihit is an erratum where some processors may incur a machine check5error, possibly resulting in an unrecoverable CPU lockup, when an6instruction fetch hits multiple entries in the instruction TLB. This can7occur when the page size is changed along with either the physical address8or cache type. A malicious guest running on a virtualized system can9exploit this erratum to perform a denial of service attack.10 11 12Affected processors13-------------------14 15Variations of this erratum are present on most Intel Core and Xeon processor16models. The erratum is not present on:17 18 - non-Intel processors19 20 - Some Atoms (Airmont, Bonnell, Goldmont, GoldmontPlus, Saltwell, Silvermont)21 22 - Intel processors that have the PSCHANGE_MC_NO bit set in the23 IA32_ARCH_CAPABILITIES MSR.24 25 26Related CVEs27------------28 29The following CVE entry is related to this issue:30 31 ============== =================================================32 CVE-2018-12207 Machine Check Error Avoidance on Page Size Change33 ============== =================================================34 35 36Problem37-------38 39Privileged software, including OS and virtual machine managers (VMM), are in40charge of memory management. A key component in memory management is the control41of the page tables. Modern processors use virtual memory, a technique that creates42the illusion of a very large memory for processors. This virtual space is split43into pages of a given size. Page tables translate virtual addresses to physical44addresses.45 46To reduce latency when performing a virtual to physical address translation,47processors include a structure, called TLB, that caches recent translations.48There are separate TLBs for instruction (iTLB) and data (dTLB).49 50Under this errata, instructions are fetched from a linear address translated51using a 4 KB translation cached in the iTLB. Privileged software modifies the52paging structure so that the same linear address using large page size (2 MB, 453MB, 1 GB) with a different physical address or memory type. After the page54structure modification but before the software invalidates any iTLB entries for55the linear address, a code fetch that happens on the same linear address may56cause a machine-check error which can result in a system hang or shutdown.57 58 59Attack scenarios60----------------61 62Attacks against the iTLB multihit erratum can be mounted from malicious63guests in a virtualized system.64 65 66iTLB multihit system information67--------------------------------68 69The Linux kernel provides a sysfs interface to enumerate the current iTLB70multihit status of the system:whether the system is vulnerable and which71mitigations are active. The relevant sysfs file is:72 73/sys/devices/system/cpu/vulnerabilities/itlb_multihit74 75The possible values in this file are:76 77.. list-table::78 79 * - Not affected80 - The processor is not vulnerable.81 * - KVM: Mitigation: Split huge pages82 - Software changes mitigate this issue.83 * - KVM: Mitigation: VMX unsupported84 - KVM is not vulnerable because Virtual Machine Extensions (VMX) is not supported.85 * - KVM: Mitigation: VMX disabled86 - KVM is not vulnerable because Virtual Machine Extensions (VMX) is disabled.87 * - KVM: Vulnerable88 - The processor is vulnerable, but no mitigation enabled89 90 91Enumeration of the erratum92--------------------------------93 94A new bit has been allocated in the IA32_ARCH_CAPABILITIES (PSCHANGE_MC_NO) msr95and will be set on CPU's which are mitigated against this issue.96 97 ======================================= =========== ===============================98 IA32_ARCH_CAPABILITIES MSR Not present Possibly vulnerable,check model99 IA32_ARCH_CAPABILITIES[PSCHANGE_MC_NO] '0' Likely vulnerable,check model100 IA32_ARCH_CAPABILITIES[PSCHANGE_MC_NO] '1' Not vulnerable101 ======================================= =========== ===============================102 103 104Mitigation mechanism105-------------------------106 107This erratum can be mitigated by restricting the use of large page sizes to108non-executable pages. This forces all iTLB entries to be 4K, and removes109the possibility of multiple hits.110 111In order to mitigate the vulnerability, KVM initially marks all huge pages112as non-executable. If the guest attempts to execute in one of those pages,113the page is broken down into 4K pages, which are then marked executable.114 115If EPT is disabled or not available on the host, KVM is in control of TLB116flushes and the problematic situation cannot happen. However, the shadow117EPT paging mechanism used by nested virtualization is vulnerable, because118the nested guest can trigger multiple iTLB hits by modifying its own119(non-nested) page tables. For simplicity, KVM will make large pages120non-executable in all shadow paging modes.121 122Mitigation control on the kernel command line and KVM - module parameter123------------------------------------------------------------------------124 125The KVM hypervisor mitigation mechanism for marking huge pages as126non-executable can be controlled with a module parameter "nx_huge_pages=".127The kernel command line allows to control the iTLB multihit mitigations at128boot time with the option "kvm.nx_huge_pages=".129 130The valid arguments for these options are:131 132 ========== ================================================================133 force Mitigation is enabled. In this case, the mitigation implements134 non-executable huge pages in Linux kernel KVM module. All huge135 pages in the EPT are marked as non-executable.136 If a guest attempts to execute in one of those pages, the page is137 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 kernel142 was not booted with the "mitigations=off" command line parameter.143 This is the default option.144 ========== ================================================================145 146 147Mitigation selection guide148--------------------------149 1501. No virtualization in use151^^^^^^^^^^^^^^^^^^^^^^^^^^^152 153 The system is protected by the kernel unconditionally and no further154 action is required.155 1562. Virtualization with trusted guests157^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^158 159 If the guest comes from a trusted source, you may assume that the guest will160 not attempt to maliciously exploit these errata and no further action is161 required.162 1633. Virtualization with untrusted guests164^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^165 If the guest comes from an untrusted source, the guest host kernel will need166 to apply iTLB multihit mitigation via the kernel command line or kvm167 module parameter.168