162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ciTAA - TSX Asynchronous Abort 462306a36Sopenharmony_ci====================================== 562306a36Sopenharmony_ci 662306a36Sopenharmony_ciTAA is a hardware vulnerability that allows unprivileged speculative access to 762306a36Sopenharmony_cidata which is available in various CPU internal buffers by using asynchronous 862306a36Sopenharmony_ciaborts within an Intel TSX transactional region. 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciAffected processors 1162306a36Sopenharmony_ci------------------- 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ciThis vulnerability only affects Intel processors that support Intel 1462306a36Sopenharmony_ciTransactional Synchronization Extensions (TSX) when the TAA_NO bit (bit 8) 1562306a36Sopenharmony_ciis 0 in the IA32_ARCH_CAPABILITIES MSR. On processors where the MDS_NO bit 1662306a36Sopenharmony_ci(bit 5) is 0 in the IA32_ARCH_CAPABILITIES MSR, the existing MDS mitigations 1762306a36Sopenharmony_cialso mitigate against TAA. 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ciWhether a processor is affected or not can be read out from the TAA 2062306a36Sopenharmony_civulnerability file in sysfs. See :ref:`tsx_async_abort_sys_info`. 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciRelated CVEs 2362306a36Sopenharmony_ci------------ 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ciThe following CVE entry is related to this TAA issue: 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci ============== ===== =================================================== 2862306a36Sopenharmony_ci CVE-2019-11135 TAA TSX Asynchronous Abort (TAA) condition on some 2962306a36Sopenharmony_ci microprocessors utilizing speculative execution may 3062306a36Sopenharmony_ci allow an authenticated user to potentially enable 3162306a36Sopenharmony_ci information disclosure via a side channel with 3262306a36Sopenharmony_ci local access. 3362306a36Sopenharmony_ci ============== ===== =================================================== 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ciProblem 3662306a36Sopenharmony_ci------- 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ciWhen performing store, load or L1 refill operations, processors write 3962306a36Sopenharmony_cidata into temporary microarchitectural structures (buffers). The data in 4062306a36Sopenharmony_cithose buffers can be forwarded to load operations as an optimization. 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ciIntel TSX is an extension to the x86 instruction set architecture that adds 4362306a36Sopenharmony_cihardware transactional memory support to improve performance of multi-threaded 4462306a36Sopenharmony_cisoftware. TSX lets the processor expose and exploit concurrency hidden in an 4562306a36Sopenharmony_ciapplication due to dynamically avoiding unnecessary synchronization. 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ciTSX supports atomic memory transactions that are either committed (success) or 4862306a36Sopenharmony_ciaborted. During an abort, operations that happened within the transactional region 4962306a36Sopenharmony_ciare rolled back. An asynchronous abort takes place, among other options, when a 5062306a36Sopenharmony_cidifferent thread accesses a cache line that is also used within the transactional 5162306a36Sopenharmony_ciregion when that access might lead to a data race. 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ciImmediately after an uncompleted asynchronous abort, certain speculatively 5462306a36Sopenharmony_ciexecuted loads may read data from those internal buffers and pass it to dependent 5562306a36Sopenharmony_cioperations. This can be then used to infer the value via a cache side channel 5662306a36Sopenharmony_ciattack. 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ciBecause the buffers are potentially shared between Hyper-Threads cross 5962306a36Sopenharmony_ciHyper-Thread attacks are possible. 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ciThe victim of a malicious actor does not need to make use of TSX. Only the 6262306a36Sopenharmony_ciattacker needs to begin a TSX transaction and raise an asynchronous abort 6362306a36Sopenharmony_ciwhich in turn potentially leaks data stored in the buffers. 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ciMore detailed technical information is available in the TAA specific x86 6662306a36Sopenharmony_ciarchitecture section: :ref:`Documentation/arch/x86/tsx_async_abort.rst <tsx_async_abort>`. 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ciAttack scenarios 7062306a36Sopenharmony_ci---------------- 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ciAttacks against the TAA vulnerability can be implemented from unprivileged 7362306a36Sopenharmony_ciapplications running on hosts or guests. 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ciAs for MDS, the attacker has no control over the memory addresses that can 7662306a36Sopenharmony_cibe leaked. Only the victim is responsible for bringing data to the CPU. As 7762306a36Sopenharmony_cia result, the malicious actor has to sample as much data as possible and 7862306a36Sopenharmony_cithen postprocess it to try to infer any useful information from it. 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_ciA potential attacker only has read access to the data. Also, there is no direct 8162306a36Sopenharmony_ciprivilege escalation by using this technique. 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci.. _tsx_async_abort_sys_info: 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ciTAA system information 8762306a36Sopenharmony_ci----------------------- 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ciThe Linux kernel provides a sysfs interface to enumerate the current TAA status 9062306a36Sopenharmony_ciof mitigated systems. The relevant sysfs file is: 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci/sys/devices/system/cpu/vulnerabilities/tsx_async_abort 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ciThe possible values in this file are: 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci.. list-table:: 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci * - 'Vulnerable' 9962306a36Sopenharmony_ci - The CPU is affected by this vulnerability and the microcode and kernel mitigation are not applied. 10062306a36Sopenharmony_ci * - 'Vulnerable: Clear CPU buffers attempted, no microcode' 10162306a36Sopenharmony_ci - The system tries to clear the buffers but the microcode might not support the operation. 10262306a36Sopenharmony_ci * - 'Mitigation: Clear CPU buffers' 10362306a36Sopenharmony_ci - The microcode has been updated to clear the buffers. TSX is still enabled. 10462306a36Sopenharmony_ci * - 'Mitigation: TSX disabled' 10562306a36Sopenharmony_ci - TSX is disabled. 10662306a36Sopenharmony_ci * - 'Not affected' 10762306a36Sopenharmony_ci - The CPU is not affected by this issue. 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci.. _ucode_needed: 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ciBest effort mitigation mode 11262306a36Sopenharmony_ci^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ciIf the processor is vulnerable, but the availability of the microcode-based 11562306a36Sopenharmony_cimitigation mechanism is not advertised via CPUID the kernel selects a best 11662306a36Sopenharmony_cieffort mitigation mode. This mode invokes the mitigation instructions 11762306a36Sopenharmony_ciwithout a guarantee that they clear the CPU buffers. 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ciThis is done to address virtualization scenarios where the host has the 12062306a36Sopenharmony_cimicrocode update applied, but the hypervisor is not yet updated to expose the 12162306a36Sopenharmony_ciCPUID to the guest. If the host has updated microcode the protection takes 12262306a36Sopenharmony_cieffect; otherwise a few CPU cycles are wasted pointlessly. 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ciThe state in the tsx_async_abort sysfs file reflects this situation 12562306a36Sopenharmony_ciaccordingly. 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ciMitigation mechanism 12962306a36Sopenharmony_ci-------------------- 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ciThe kernel detects the affected CPUs and the presence of the microcode which is 13262306a36Sopenharmony_cirequired. If a CPU is affected and the microcode is available, then the kernel 13362306a36Sopenharmony_cienables the mitigation by default. 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ciThe mitigation can be controlled at boot time via a kernel command line option. 13762306a36Sopenharmony_ciSee :ref:`taa_mitigation_control_command_line`. 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_ciVirtualization mitigation 14062306a36Sopenharmony_ci^^^^^^^^^^^^^^^^^^^^^^^^^ 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ciAffected systems where the host has TAA microcode and TAA is mitigated by 14362306a36Sopenharmony_cihaving disabled TSX previously, are not vulnerable regardless of the status 14462306a36Sopenharmony_ciof the VMs. 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ciIn all other cases, if the host either does not have the TAA microcode or 14762306a36Sopenharmony_cithe kernel is not mitigated, the system might be vulnerable. 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci.. _taa_mitigation_control_command_line: 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ciMitigation control on the kernel command line 15362306a36Sopenharmony_ci--------------------------------------------- 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ciThe kernel command line allows to control the TAA mitigations at boot time with 15662306a36Sopenharmony_cithe option "tsx_async_abort=". The valid arguments for this option are: 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ci ============ ============================================================= 15962306a36Sopenharmony_ci off This option disables the TAA mitigation on affected platforms. 16062306a36Sopenharmony_ci If the system has TSX enabled (see next parameter) and the CPU 16162306a36Sopenharmony_ci is affected, the system is vulnerable. 16262306a36Sopenharmony_ci 16362306a36Sopenharmony_ci full TAA mitigation is enabled. If TSX is enabled, on an affected 16462306a36Sopenharmony_ci system it will clear CPU buffers on ring transitions. On 16562306a36Sopenharmony_ci systems which are MDS-affected and deploy MDS mitigation, 16662306a36Sopenharmony_ci TAA is also mitigated. Specifying this option on those 16762306a36Sopenharmony_ci systems will have no effect. 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci full,nosmt The same as tsx_async_abort=full, with SMT disabled on 17062306a36Sopenharmony_ci vulnerable CPUs that have TSX enabled. This is the complete 17162306a36Sopenharmony_ci mitigation. When TSX is disabled, SMT is not disabled because 17262306a36Sopenharmony_ci CPU is not vulnerable to cross-thread TAA attacks. 17362306a36Sopenharmony_ci ============ ============================================================= 17462306a36Sopenharmony_ci 17562306a36Sopenharmony_ciNot specifying this option is equivalent to "tsx_async_abort=full". For 17662306a36Sopenharmony_ciprocessors that are affected by both TAA and MDS, specifying just 17762306a36Sopenharmony_ci"tsx_async_abort=off" without an accompanying "mds=off" will have no 17862306a36Sopenharmony_cieffect as the same mitigation is used for both vulnerabilities. 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ciThe kernel command line also allows to control the TSX feature using the 18162306a36Sopenharmony_ciparameter "tsx=" on CPUs which support TSX control. MSR_IA32_TSX_CTRL is used 18262306a36Sopenharmony_cito control the TSX feature and the enumeration of the TSX feature bits (RTM 18362306a36Sopenharmony_ciand HLE) in CPUID. 18462306a36Sopenharmony_ci 18562306a36Sopenharmony_ciThe valid options are: 18662306a36Sopenharmony_ci 18762306a36Sopenharmony_ci ============ ============================================================= 18862306a36Sopenharmony_ci off Disables TSX on the system. 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ci Note that this option takes effect only on newer CPUs which are 19162306a36Sopenharmony_ci not vulnerable to MDS, i.e., have MSR_IA32_ARCH_CAPABILITIES.MDS_NO=1 19262306a36Sopenharmony_ci and which get the new IA32_TSX_CTRL MSR through a microcode 19362306a36Sopenharmony_ci update. This new MSR allows for the reliable deactivation of 19462306a36Sopenharmony_ci the TSX functionality. 19562306a36Sopenharmony_ci 19662306a36Sopenharmony_ci on Enables TSX. 19762306a36Sopenharmony_ci 19862306a36Sopenharmony_ci Although there are mitigations for all known security 19962306a36Sopenharmony_ci vulnerabilities, TSX has been known to be an accelerator for 20062306a36Sopenharmony_ci several previous speculation-related CVEs, and so there may be 20162306a36Sopenharmony_ci unknown security risks associated with leaving it enabled. 20262306a36Sopenharmony_ci 20362306a36Sopenharmony_ci auto Disables TSX if X86_BUG_TAA is present, otherwise enables TSX 20462306a36Sopenharmony_ci on the system. 20562306a36Sopenharmony_ci ============ ============================================================= 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_ciNot specifying this option is equivalent to "tsx=off". 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ciThe following combinations of the "tsx_async_abort" and "tsx" are possible. For 21062306a36Sopenharmony_ciaffected platforms tsx=auto is equivalent to tsx=off and the result will be: 21162306a36Sopenharmony_ci 21262306a36Sopenharmony_ci ========= ========================== ========================================= 21362306a36Sopenharmony_ci tsx=on tsx_async_abort=full The system will use VERW to clear CPU 21462306a36Sopenharmony_ci buffers. Cross-thread attacks are still 21562306a36Sopenharmony_ci possible on SMT machines. 21662306a36Sopenharmony_ci tsx=on tsx_async_abort=full,nosmt As above, cross-thread attacks on SMT 21762306a36Sopenharmony_ci mitigated. 21862306a36Sopenharmony_ci tsx=on tsx_async_abort=off The system is vulnerable. 21962306a36Sopenharmony_ci tsx=off tsx_async_abort=full TSX might be disabled if microcode 22062306a36Sopenharmony_ci provides a TSX control MSR. If so, 22162306a36Sopenharmony_ci system is not vulnerable. 22262306a36Sopenharmony_ci tsx=off tsx_async_abort=full,nosmt Ditto 22362306a36Sopenharmony_ci tsx=off tsx_async_abort=off ditto 22462306a36Sopenharmony_ci ========= ========================== ========================================= 22562306a36Sopenharmony_ci 22662306a36Sopenharmony_ci 22762306a36Sopenharmony_ciFor unaffected platforms "tsx=on" and "tsx_async_abort=full" does not clear CPU 22862306a36Sopenharmony_cibuffers. For platforms without TSX control (MSR_IA32_ARCH_CAPABILITIES.MDS_NO=0) 22962306a36Sopenharmony_ci"tsx" command line argument has no effect. 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ciFor the affected platforms below table indicates the mitigation status for the 23262306a36Sopenharmony_cicombinations of CPUID bit MD_CLEAR and IA32_ARCH_CAPABILITIES MSR bits MDS_NO 23362306a36Sopenharmony_ciand TSX_CTRL_MSR. 23462306a36Sopenharmony_ci 23562306a36Sopenharmony_ci ======= ========= ============= ======================================== 23662306a36Sopenharmony_ci MDS_NO MD_CLEAR TSX_CTRL_MSR Status 23762306a36Sopenharmony_ci ======= ========= ============= ======================================== 23862306a36Sopenharmony_ci 0 0 0 Vulnerable (needs microcode) 23962306a36Sopenharmony_ci 0 1 0 MDS and TAA mitigated via VERW 24062306a36Sopenharmony_ci 1 1 0 MDS fixed, TAA vulnerable if TSX enabled 24162306a36Sopenharmony_ci because MD_CLEAR has no meaning and 24262306a36Sopenharmony_ci VERW is not guaranteed to clear buffers 24362306a36Sopenharmony_ci 1 X 1 MDS fixed, TAA can be mitigated by 24462306a36Sopenharmony_ci VERW or TSX_CTRL_MSR 24562306a36Sopenharmony_ci ======= ========= ============= ======================================== 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_ciMitigation selection guide 24862306a36Sopenharmony_ci-------------------------- 24962306a36Sopenharmony_ci 25062306a36Sopenharmony_ci1. Trusted userspace and guests 25162306a36Sopenharmony_ci^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 25262306a36Sopenharmony_ci 25362306a36Sopenharmony_ciIf all user space applications are from a trusted source and do not execute 25462306a36Sopenharmony_ciuntrusted code which is supplied externally, then the mitigation can be 25562306a36Sopenharmony_cidisabled. The same applies to virtualized environments with trusted guests. 25662306a36Sopenharmony_ci 25762306a36Sopenharmony_ci 25862306a36Sopenharmony_ci2. Untrusted userspace and guests 25962306a36Sopenharmony_ci^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 26062306a36Sopenharmony_ci 26162306a36Sopenharmony_ciIf there are untrusted applications or guests on the system, enabling TSX 26262306a36Sopenharmony_cimight allow a malicious actor to leak data from the host or from other 26362306a36Sopenharmony_ciprocesses running on the same physical core. 26462306a36Sopenharmony_ci 26562306a36Sopenharmony_ciIf the microcode is available and the TSX is disabled on the host, attacks 26662306a36Sopenharmony_ciare prevented in a virtualized environment as well, even if the VMs do not 26762306a36Sopenharmony_ciexplicitly enable the mitigation. 26862306a36Sopenharmony_ci 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_ci.. _taa_default_mitigations: 27162306a36Sopenharmony_ci 27262306a36Sopenharmony_ciDefault mitigations 27362306a36Sopenharmony_ci------------------- 27462306a36Sopenharmony_ci 27562306a36Sopenharmony_ciThe kernel's default action for vulnerable processors is: 27662306a36Sopenharmony_ci 27762306a36Sopenharmony_ci - Deploy TSX disable mitigation (tsx_async_abort=full tsx=off). 278