18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciTSX Async Abort (TAA) mitigation
48c2ecf20Sopenharmony_ci================================
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci.. _tsx_async_abort:
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ciOverview
98c2ecf20Sopenharmony_ci--------
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ciTSX Async Abort (TAA) is a side channel attack on internal buffers in some
128c2ecf20Sopenharmony_ciIntel processors similar to Microachitectural Data Sampling (MDS).  In this
138c2ecf20Sopenharmony_cicase certain loads may speculatively pass invalid data to dependent operations
148c2ecf20Sopenharmony_ciwhen an asynchronous abort condition is pending in a Transactional
158c2ecf20Sopenharmony_ciSynchronization Extensions (TSX) transaction.  This includes loads with no
168c2ecf20Sopenharmony_cifault or assist condition. Such loads may speculatively expose stale data from
178c2ecf20Sopenharmony_cithe same uarch data structures as in MDS, with same scope of exposure i.e.
188c2ecf20Sopenharmony_cisame-thread and cross-thread. This issue affects all current processors that
198c2ecf20Sopenharmony_cisupport TSX.
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciMitigation strategy
228c2ecf20Sopenharmony_ci-------------------
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cia) TSX disable - one of the mitigations is to disable TSX. A new MSR
258c2ecf20Sopenharmony_ciIA32_TSX_CTRL will be available in future and current processors after
268c2ecf20Sopenharmony_cimicrocode update which can be used to disable TSX. In addition, it
278c2ecf20Sopenharmony_cicontrols the enumeration of the TSX feature bits (RTM and HLE) in CPUID.
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cib) Clear CPU buffers - similar to MDS, clearing the CPU buffers mitigates this
308c2ecf20Sopenharmony_civulnerability. More details on this approach can be found in
318c2ecf20Sopenharmony_ci:ref:`Documentation/admin-guide/hw-vuln/mds.rst <mds>`.
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ciKernel internal mitigation modes
348c2ecf20Sopenharmony_ci--------------------------------
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci =============    ============================================================
378c2ecf20Sopenharmony_ci off              Mitigation is disabled. Either the CPU is not affected or
388c2ecf20Sopenharmony_ci                  tsx_async_abort=off is supplied on the kernel command line.
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci tsx disabled     Mitigation is enabled. TSX feature is disabled by default at
418c2ecf20Sopenharmony_ci                  bootup on processors that support TSX control.
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci verw             Mitigation is enabled. CPU is affected and MD_CLEAR is
448c2ecf20Sopenharmony_ci                  advertised in CPUID.
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci ucode needed     Mitigation is enabled. CPU is affected and MD_CLEAR is not
478c2ecf20Sopenharmony_ci                  advertised in CPUID. That is mainly for virtualization
488c2ecf20Sopenharmony_ci                  scenarios where the host has the updated microcode but the
498c2ecf20Sopenharmony_ci                  hypervisor does not expose MD_CLEAR in CPUID. It's a best
508c2ecf20Sopenharmony_ci                  effort approach without guarantee.
518c2ecf20Sopenharmony_ci =============    ============================================================
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciIf the CPU is affected and the "tsx_async_abort" kernel command line parameter is
548c2ecf20Sopenharmony_cinot provided then the kernel selects an appropriate mitigation depending on the
558c2ecf20Sopenharmony_cistatus of RTM and MD_CLEAR CPUID bits.
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciBelow tables indicate the impact of tsx=on|off|auto cmdline options on state of
588c2ecf20Sopenharmony_ciTAA mitigation, VERW behavior and TSX feature for various combinations of
598c2ecf20Sopenharmony_ciMSR_IA32_ARCH_CAPABILITIES bits.
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci1. "tsx=off"
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci=========  =========  ============  ============  ==============  ===================  ======================
648c2ecf20Sopenharmony_ciMSR_IA32_ARCH_CAPABILITIES bits     Result with cmdline tsx=off
658c2ecf20Sopenharmony_ci----------------------------------  -------------------------------------------------------------------------
668c2ecf20Sopenharmony_ciTAA_NO     MDS_NO     TSX_CTRL_MSR  TSX state     VERW can clear  TAA mitigation       TAA mitigation
678c2ecf20Sopenharmony_ci                                    after bootup  CPU buffers     tsx_async_abort=off  tsx_async_abort=full
688c2ecf20Sopenharmony_ci=========  =========  ============  ============  ==============  ===================  ======================
698c2ecf20Sopenharmony_ci    0          0           0         HW default         Yes           Same as MDS           Same as MDS
708c2ecf20Sopenharmony_ci    0          0           1        Invalid case   Invalid case       Invalid case          Invalid case
718c2ecf20Sopenharmony_ci    0          1           0         HW default         No         Need ucode update     Need ucode update
728c2ecf20Sopenharmony_ci    0          1           1          Disabled          Yes           TSX disabled          TSX disabled
738c2ecf20Sopenharmony_ci    1          X           1          Disabled           X             None needed           None needed
748c2ecf20Sopenharmony_ci=========  =========  ============  ============  ==============  ===================  ======================
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci2. "tsx=on"
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci=========  =========  ============  ============  ==============  ===================  ======================
798c2ecf20Sopenharmony_ciMSR_IA32_ARCH_CAPABILITIES bits     Result with cmdline tsx=on
808c2ecf20Sopenharmony_ci----------------------------------  -------------------------------------------------------------------------
818c2ecf20Sopenharmony_ciTAA_NO     MDS_NO     TSX_CTRL_MSR  TSX state     VERW can clear  TAA mitigation       TAA mitigation
828c2ecf20Sopenharmony_ci                                    after bootup  CPU buffers     tsx_async_abort=off  tsx_async_abort=full
838c2ecf20Sopenharmony_ci=========  =========  ============  ============  ==============  ===================  ======================
848c2ecf20Sopenharmony_ci    0          0           0         HW default        Yes            Same as MDS          Same as MDS
858c2ecf20Sopenharmony_ci    0          0           1        Invalid case   Invalid case       Invalid case         Invalid case
868c2ecf20Sopenharmony_ci    0          1           0         HW default        No          Need ucode update     Need ucode update
878c2ecf20Sopenharmony_ci    0          1           1          Enabled          Yes               None              Same as MDS
888c2ecf20Sopenharmony_ci    1          X           1          Enabled          X              None needed          None needed
898c2ecf20Sopenharmony_ci=========  =========  ============  ============  ==============  ===================  ======================
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci3. "tsx=auto"
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci=========  =========  ============  ============  ==============  ===================  ======================
948c2ecf20Sopenharmony_ciMSR_IA32_ARCH_CAPABILITIES bits     Result with cmdline tsx=auto
958c2ecf20Sopenharmony_ci----------------------------------  -------------------------------------------------------------------------
968c2ecf20Sopenharmony_ciTAA_NO     MDS_NO     TSX_CTRL_MSR  TSX state     VERW can clear  TAA mitigation       TAA mitigation
978c2ecf20Sopenharmony_ci                                    after bootup  CPU buffers     tsx_async_abort=off  tsx_async_abort=full
988c2ecf20Sopenharmony_ci=========  =========  ============  ============  ==============  ===================  ======================
998c2ecf20Sopenharmony_ci    0          0           0         HW default    Yes                Same as MDS           Same as MDS
1008c2ecf20Sopenharmony_ci    0          0           1        Invalid case  Invalid case        Invalid case          Invalid case
1018c2ecf20Sopenharmony_ci    0          1           0         HW default    No              Need ucode update     Need ucode update
1028c2ecf20Sopenharmony_ci    0          1           1          Disabled      Yes               TSX disabled          TSX disabled
1038c2ecf20Sopenharmony_ci    1          X           1          Enabled       X                 None needed           None needed
1048c2ecf20Sopenharmony_ci=========  =========  ============  ============  ==============  ===================  ======================
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ciIn the tables, TSX_CTRL_MSR is a new bit in MSR_IA32_ARCH_CAPABILITIES that
1078c2ecf20Sopenharmony_ciindicates whether MSR_IA32_TSX_CTRL is supported.
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ciThere are two control bits in IA32_TSX_CTRL MSR:
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci      Bit 0: When set it disables the Restricted Transactional Memory (RTM)
1128c2ecf20Sopenharmony_ci             sub-feature of TSX (will force all transactions to abort on the
1138c2ecf20Sopenharmony_ci             XBEGIN instruction).
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci      Bit 1: When set it disables the enumeration of the RTM and HLE feature
1168c2ecf20Sopenharmony_ci             (i.e. it will make CPUID(EAX=7).EBX{bit4} and
1178c2ecf20Sopenharmony_ci             CPUID(EAX=7).EBX{bit11} read as 0).
118