tsx_async_abort.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. .. SPDX-License-Identifier: GPL-2.0
  2. TAA - TSX Asynchronous Abort
  3. ======================================
  4. TAA is a hardware vulnerability that allows unprivileged speculative access to
  5. data which is available in various CPU internal buffers by using asynchronous
  6. aborts within an Intel TSX transactional region.
  7. Affected processors
  8. -------------------
  9. This vulnerability only affects Intel processors that support Intel
  10. Transactional Synchronization Extensions (TSX) when the TAA_NO bit (bit 8)
  11. is 0 in the IA32_ARCH_CAPABILITIES MSR. On processors where the MDS_NO bit
  12. (bit 5) is 0 in the IA32_ARCH_CAPABILITIES MSR, the existing MDS mitigations
  13. also mitigate against TAA.
  14. Whether a processor is affected or not can be read out from the TAA
  15. vulnerability file in sysfs. See :ref:`tsx_async_abort_sys_info`.
  16. Related CVEs
  17. ------------
  18. The following CVE entry is related to this TAA issue:
  19. ============== ===== ===================================================
  20. CVE-2019-11135 TAA TSX Asynchronous Abort (TAA) condition on some
  21. microprocessors utilizing speculative execution may
  22. allow an authenticated user to potentially enable
  23. information disclosure via a side channel with
  24. local access.
  25. ============== ===== ===================================================
  26. Problem
  27. -------
  28. When performing store, load or L1 refill operations, processors write
  29. data into temporary microarchitectural structures (buffers). The data in
  30. those buffers can be forwarded to load operations as an optimization.
  31. Intel TSX is an extension to the x86 instruction set architecture that adds
  32. hardware transactional memory support to improve performance of multi-threaded
  33. software. TSX lets the processor expose and exploit concurrency hidden in an
  34. application due to dynamically avoiding unnecessary synchronization.
  35. TSX supports atomic memory transactions that are either committed (success) or
  36. aborted. During an abort, operations that happened within the transactional region
  37. are rolled back. An asynchronous abort takes place, among other options, when a
  38. different thread accesses a cache line that is also used within the transactional
  39. region when that access might lead to a data race.
  40. Immediately after an uncompleted asynchronous abort, certain speculatively
  41. executed loads may read data from those internal buffers and pass it to dependent
  42. operations. This can be then used to infer the value via a cache side channel
  43. attack.
  44. Because the buffers are potentially shared between Hyper-Threads cross
  45. Hyper-Thread attacks are possible.
  46. The victim of a malicious actor does not need to make use of TSX. Only the
  47. attacker needs to begin a TSX transaction and raise an asynchronous abort
  48. which in turn potenitally leaks data stored in the buffers.
  49. More detailed technical information is available in the TAA specific x86
  50. architecture section: :ref:`Documentation/x86/tsx_async_abort.rst <tsx_async_abort>`.
  51. Attack scenarios
  52. ----------------
  53. Attacks against the TAA vulnerability can be implemented from unprivileged
  54. applications running on hosts or guests.
  55. As for MDS, the attacker has no control over the memory addresses that can
  56. be leaked. Only the victim is responsible for bringing data to the CPU. As
  57. a result, the malicious actor has to sample as much data as possible and
  58. then postprocess it to try to infer any useful information from it.
  59. A potential attacker only has read access to the data. Also, there is no direct
  60. privilege escalation by using this technique.
  61. .. _tsx_async_abort_sys_info:
  62. TAA system information
  63. -----------------------
  64. The Linux kernel provides a sysfs interface to enumerate the current TAA status
  65. of mitigated systems. The relevant sysfs file is:
  66. /sys/devices/system/cpu/vulnerabilities/tsx_async_abort
  67. The possible values in this file are:
  68. .. list-table::
  69. * - 'Vulnerable'
  70. - The CPU is affected by this vulnerability and the microcode and kernel mitigation are not applied.
  71. * - 'Vulnerable: Clear CPU buffers attempted, no microcode'
  72. - The system tries to clear the buffers but the microcode might not support the operation.
  73. * - 'Mitigation: Clear CPU buffers'
  74. - The microcode has been updated to clear the buffers. TSX is still enabled.
  75. * - 'Mitigation: TSX disabled'
  76. - TSX is disabled.
  77. * - 'Not affected'
  78. - The CPU is not affected by this issue.
  79. .. _ucode_needed:
  80. Best effort mitigation mode
  81. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  82. If the processor is vulnerable, but the availability of the microcode-based
  83. mitigation mechanism is not advertised via CPUID the kernel selects a best
  84. effort mitigation mode. This mode invokes the mitigation instructions
  85. without a guarantee that they clear the CPU buffers.
  86. This is done to address virtualization scenarios where the host has the
  87. microcode update applied, but the hypervisor is not yet updated to expose the
  88. CPUID to the guest. If the host has updated microcode the protection takes
  89. effect; otherwise a few CPU cycles are wasted pointlessly.
  90. The state in the tsx_async_abort sysfs file reflects this situation
  91. accordingly.
  92. Mitigation mechanism
  93. --------------------
  94. The kernel detects the affected CPUs and the presence of the microcode which is
  95. required. If a CPU is affected and the microcode is available, then the kernel
  96. enables the mitigation by default.
  97. The mitigation can be controlled at boot time via a kernel command line option.
  98. See :ref:`taa_mitigation_control_command_line`.
  99. .. _virt_mechanism:
  100. Virtualization mitigation
  101. ^^^^^^^^^^^^^^^^^^^^^^^^^
  102. Affected systems where the host has TAA microcode and TAA is mitigated by
  103. having disabled TSX previously, are not vulnerable regardless of the status
  104. of the VMs.
  105. In all other cases, if the host either does not have the TAA microcode or
  106. the kernel is not mitigated, the system might be vulnerable.
  107. .. _taa_mitigation_control_command_line:
  108. Mitigation control on the kernel command line
  109. ---------------------------------------------
  110. The kernel command line allows to control the TAA mitigations at boot time with
  111. the option "tsx_async_abort=". The valid arguments for this option are:
  112. ============ =============================================================
  113. off This option disables the TAA mitigation on affected platforms.
  114. If the system has TSX enabled (see next parameter) and the CPU
  115. is affected, the system is vulnerable.
  116. full TAA mitigation is enabled. If TSX is enabled, on an affected
  117. system it will clear CPU buffers on ring transitions. On
  118. systems which are MDS-affected and deploy MDS mitigation,
  119. TAA is also mitigated. Specifying this option on those
  120. systems will have no effect.
  121. full,nosmt The same as tsx_async_abort=full, with SMT disabled on
  122. vulnerable CPUs that have TSX enabled. This is the complete
  123. mitigation. When TSX is disabled, SMT is not disabled because
  124. CPU is not vulnerable to cross-thread TAA attacks.
  125. ============ =============================================================
  126. Not specifying this option is equivalent to "tsx_async_abort=full". For
  127. processors that are affected by both TAA and MDS, specifying just
  128. "tsx_async_abort=off" without an accompanying "mds=off" will have no
  129. effect as the same mitigation is used for both vulnerabilities.
  130. The kernel command line also allows to control the TSX feature using the
  131. parameter "tsx=" on CPUs which support TSX control. MSR_IA32_TSX_CTRL is used
  132. to control the TSX feature and the enumeration of the TSX feature bits (RTM
  133. and HLE) in CPUID.
  134. The valid options are:
  135. ============ =============================================================
  136. off Disables TSX on the system.
  137. Note that this option takes effect only on newer CPUs which are
  138. not vulnerable to MDS, i.e., have MSR_IA32_ARCH_CAPABILITIES.MDS_NO=1
  139. and which get the new IA32_TSX_CTRL MSR through a microcode
  140. update. This new MSR allows for the reliable deactivation of
  141. the TSX functionality.
  142. on Enables TSX.
  143. Although there are mitigations for all known security
  144. vulnerabilities, TSX has been known to be an accelerator for
  145. several previous speculation-related CVEs, and so there may be
  146. unknown security risks associated with leaving it enabled.
  147. auto Disables TSX if X86_BUG_TAA is present, otherwise enables TSX
  148. on the system.
  149. ============ =============================================================
  150. Not specifying this option is equivalent to "tsx=off".
  151. The following combinations of the "tsx_async_abort" and "tsx" are possible. For
  152. affected platforms tsx=auto is equivalent to tsx=off and the result will be:
  153. ========= ========================== =========================================
  154. tsx=on tsx_async_abort=full The system will use VERW to clear CPU
  155. buffers. Cross-thread attacks are still
  156. possible on SMT machines.
  157. tsx=on tsx_async_abort=full,nosmt As above, cross-thread attacks on SMT
  158. mitigated.
  159. tsx=on tsx_async_abort=off The system is vulnerable.
  160. tsx=off tsx_async_abort=full TSX might be disabled if microcode
  161. provides a TSX control MSR. If so,
  162. system is not vulnerable.
  163. tsx=off tsx_async_abort=full,nosmt Ditto
  164. tsx=off tsx_async_abort=off ditto
  165. ========= ========================== =========================================
  166. For unaffected platforms "tsx=on" and "tsx_async_abort=full" does not clear CPU
  167. buffers. For platforms without TSX control (MSR_IA32_ARCH_CAPABILITIES.MDS_NO=0)
  168. "tsx" command line argument has no effect.
  169. For the affected platforms below table indicates the mitigation status for the
  170. combinations of CPUID bit MD_CLEAR and IA32_ARCH_CAPABILITIES MSR bits MDS_NO
  171. and TSX_CTRL_MSR.
  172. ======= ========= ============= ========================================
  173. MDS_NO MD_CLEAR TSX_CTRL_MSR Status
  174. ======= ========= ============= ========================================
  175. 0 0 0 Vulnerable (needs microcode)
  176. 0 1 0 MDS and TAA mitigated via VERW
  177. 1 1 0 MDS fixed, TAA vulnerable if TSX enabled
  178. because MD_CLEAR has no meaning and
  179. VERW is not guaranteed to clear buffers
  180. 1 X 1 MDS fixed, TAA can be mitigated by
  181. VERW or TSX_CTRL_MSR
  182. ======= ========= ============= ========================================
  183. Mitigation selection guide
  184. --------------------------
  185. 1. Trusted userspace and guests
  186. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  187. If all user space applications are from a trusted source and do not execute
  188. untrusted code which is supplied externally, then the mitigation can be
  189. disabled. The same applies to virtualized environments with trusted guests.
  190. 2. Untrusted userspace and guests
  191. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  192. If there are untrusted applications or guests on the system, enabling TSX
  193. might allow a malicious actor to leak data from the host or from other
  194. processes running on the same physical core.
  195. If the microcode is available and the TSX is disabled on the host, attacks
  196. are prevented in a virtualized environment as well, even if the VMs do not
  197. explicitly enable the mitigation.
  198. .. _taa_default_mitigations:
  199. Default mitigations
  200. -------------------
  201. The kernel's default action for vulnerable processors is:
  202. - Deploy TSX disable mitigation (tsx_async_abort=full tsx=off).