11caa1b05SDavid Kaplan.. SPDX-License-Identifier: GPL-2.0 21caa1b05SDavid Kaplan 31caa1b05SDavid KaplanAttack Vector Controls 41caa1b05SDavid Kaplan====================== 51caa1b05SDavid Kaplan 61caa1b05SDavid KaplanAttack vector controls provide a simple method to configure only the mitigations 71caa1b05SDavid Kaplanfor CPU vulnerabilities which are relevant given the intended use of a system. 81caa1b05SDavid KaplanAdministrators are encouraged to consider which attack vectors are relevant and 91caa1b05SDavid Kaplandisable all others in order to recoup system performance. 101caa1b05SDavid Kaplan 111caa1b05SDavid KaplanWhen new relevant CPU vulnerabilities are found, they will be added to these 121caa1b05SDavid Kaplanattack vector controls so administrators will likely not need to reconfigure 131caa1b05SDavid Kaplantheir command line parameters as mitigations will continue to be correctly 141caa1b05SDavid Kaplanapplied based on the chosen attack vector controls. 151caa1b05SDavid Kaplan 161caa1b05SDavid KaplanAttack Vectors 171caa1b05SDavid Kaplan-------------- 181caa1b05SDavid Kaplan 191caa1b05SDavid KaplanThere are 5 sets of attack-vector mitigations currently supported by the kernel: 201caa1b05SDavid Kaplan 211caa1b05SDavid Kaplan#. :ref:`user_kernel` 221caa1b05SDavid Kaplan#. :ref:`user_user` 231caa1b05SDavid Kaplan#. :ref:`guest_host` 241caa1b05SDavid Kaplan#. :ref:`guest_guest` 251caa1b05SDavid Kaplan#. :ref:`smt` 261caa1b05SDavid Kaplan 271caa1b05SDavid KaplanTo control the enabled attack vectors, see :ref:`cmdline`. 281caa1b05SDavid Kaplan 291caa1b05SDavid Kaplan.. _user_kernel: 301caa1b05SDavid Kaplan 311caa1b05SDavid KaplanUser-to-Kernel 321caa1b05SDavid Kaplan^^^^^^^^^^^^^^ 331caa1b05SDavid Kaplan 341caa1b05SDavid KaplanThe user-to-kernel attack vector involves a malicious userspace program 351caa1b05SDavid Kaplanattempting to leak kernel data into userspace by exploiting a CPU vulnerability. 361caa1b05SDavid KaplanThe kernel data involved might be limited to certain kernel memory, or include 371caa1b05SDavid Kaplanall memory in the system, depending on the vulnerability exploited. 381caa1b05SDavid Kaplan 391caa1b05SDavid KaplanIf no untrusted userspace applications are being run, such as with single-user 401caa1b05SDavid Kaplansystems, consider disabling user-to-kernel mitigations. 411caa1b05SDavid Kaplan 421caa1b05SDavid KaplanNote that the CPU vulnerabilities mitigated by Linux have generally not been 431caa1b05SDavid Kaplanshown to be exploitable from browser-based sandboxes. User-to-kernel 441caa1b05SDavid Kaplanmitigations are therefore mostly relevant if unknown userspace applications may 451caa1b05SDavid Kaplanbe run by untrusted users. 461caa1b05SDavid Kaplan 471caa1b05SDavid Kaplan*user-to-kernel mitigations are enabled by default* 481caa1b05SDavid Kaplan 491caa1b05SDavid Kaplan.. _user_user: 501caa1b05SDavid Kaplan 511caa1b05SDavid KaplanUser-to-User 521caa1b05SDavid Kaplan^^^^^^^^^^^^ 531caa1b05SDavid Kaplan 541caa1b05SDavid KaplanThe user-to-user attack vector involves a malicious userspace program attempting 551caa1b05SDavid Kaplanto influence the behavior of another unsuspecting userspace program in order to 561caa1b05SDavid Kaplanexfiltrate data. The vulnerability of a userspace program is based on the 571caa1b05SDavid Kaplanprogram itself and the interfaces it provides. 581caa1b05SDavid Kaplan 591caa1b05SDavid KaplanIf no untrusted userspace applications are being run, consider disabling 601caa1b05SDavid Kaplanuser-to-user mitigations. 611caa1b05SDavid Kaplan 621caa1b05SDavid KaplanNote that because the Linux kernel contains a mapping of all physical memory, 631caa1b05SDavid Kaplanpreventing a malicious userspace program from leaking data from another 641caa1b05SDavid Kaplanuserspace program requires mitigating user-to-kernel attacks as well for 651caa1b05SDavid Kaplancomplete protection. 661caa1b05SDavid Kaplan 671caa1b05SDavid Kaplan*user-to-user mitigations are enabled by default* 681caa1b05SDavid Kaplan 691caa1b05SDavid Kaplan.. _guest_host: 701caa1b05SDavid Kaplan 711caa1b05SDavid KaplanGuest-to-Host 721caa1b05SDavid Kaplan^^^^^^^^^^^^^ 731caa1b05SDavid Kaplan 741caa1b05SDavid KaplanThe guest-to-host attack vector involves a malicious VM attempting to leak 751caa1b05SDavid Kaplanhypervisor data into the VM. The data involved may be limited, or may 761caa1b05SDavid Kaplanpotentially include all memory in the system, depending on the vulnerability 771caa1b05SDavid Kaplanexploited. 781caa1b05SDavid Kaplan 791caa1b05SDavid KaplanIf no untrusted VMs are being run, consider disabling guest-to-host mitigations. 801caa1b05SDavid Kaplan 811caa1b05SDavid Kaplan*guest-to-host mitigations are enabled by default if KVM support is present* 821caa1b05SDavid Kaplan 831caa1b05SDavid Kaplan.. _guest_guest: 841caa1b05SDavid Kaplan 851caa1b05SDavid KaplanGuest-to-Guest 861caa1b05SDavid Kaplan^^^^^^^^^^^^^^ 871caa1b05SDavid Kaplan 881caa1b05SDavid KaplanThe guest-to-guest attack vector involves a malicious VM attempting to influence 891caa1b05SDavid Kaplanthe behavior of another unsuspecting VM in order to exfiltrate data. The 901caa1b05SDavid Kaplanvulnerability of a VM is based on the code inside the VM itself and the 911caa1b05SDavid Kaplaninterfaces it provides. 921caa1b05SDavid Kaplan 931caa1b05SDavid KaplanIf no untrusted VMs, or only a single VM is being run, consider disabling 941caa1b05SDavid Kaplanguest-to-guest mitigations. 951caa1b05SDavid Kaplan 961caa1b05SDavid KaplanSimilar to the user-to-user attack vector, preventing a malicious VM from 971caa1b05SDavid Kaplanleaking data from another VM requires mitigating guest-to-host attacks as well 981caa1b05SDavid Kaplandue to the Linux kernel phys map. 991caa1b05SDavid Kaplan 1001caa1b05SDavid Kaplan*guest-to-guest mitigations are enabled by default if KVM support is present* 1011caa1b05SDavid Kaplan 1021caa1b05SDavid Kaplan.. _smt: 1031caa1b05SDavid Kaplan 1041caa1b05SDavid KaplanCross-Thread 1051caa1b05SDavid Kaplan^^^^^^^^^^^^ 1061caa1b05SDavid Kaplan 1071caa1b05SDavid KaplanThe cross-thread attack vector involves a malicious userspace program or 1081caa1b05SDavid Kaplanmalicious VM either observing or attempting to influence the behavior of code 1091caa1b05SDavid Kaplanrunning on the SMT sibling thread in order to exfiltrate data. 1101caa1b05SDavid Kaplan 1111caa1b05SDavid KaplanMany cross-thread attacks can only be mitigated if SMT is disabled, which will 1121caa1b05SDavid Kaplanresult in reduced CPU core count and reduced performance. 1131caa1b05SDavid Kaplan 1141caa1b05SDavid KaplanIf cross-thread mitigations are fully enabled ('auto,nosmt'), all mitigations 1151caa1b05SDavid Kaplanfor cross-thread attacks will be enabled. SMT may be disabled depending on 1161caa1b05SDavid Kaplanwhich vulnerabilities are present in the CPU. 1171caa1b05SDavid Kaplan 1181caa1b05SDavid KaplanIf cross-thread mitigations are partially enabled ('auto'), mitigations for 1191caa1b05SDavid Kaplancross-thread attacks will be enabled but SMT will not be disabled. 1201caa1b05SDavid Kaplan 1211caa1b05SDavid KaplanIf cross-thread mitigations are disabled, no mitigations for cross-thread 1221caa1b05SDavid Kaplanattacks will be enabled. 1231caa1b05SDavid Kaplan 1241caa1b05SDavid KaplanCross-thread mitigation may not be required if core-scheduling or similar 1251caa1b05SDavid Kaplantechniques are used to prevent untrusted workloads from running on SMT siblings. 1261caa1b05SDavid Kaplan 1271caa1b05SDavid Kaplan*cross-thread mitigations default to partially enabled* 1281caa1b05SDavid Kaplan 1291caa1b05SDavid Kaplan.. _cmdline: 1301caa1b05SDavid Kaplan 1311caa1b05SDavid KaplanCommand Line Controls 1321caa1b05SDavid Kaplan--------------------- 1331caa1b05SDavid Kaplan 1341caa1b05SDavid KaplanAttack vectors are controlled through the mitigations= command line option. The 1351caa1b05SDavid Kaplanvalue provided begins with a global option and then may optionally include one 1361caa1b05SDavid Kaplanor more options to disable various attack vectors. 1371caa1b05SDavid Kaplan 1381caa1b05SDavid KaplanFormat: 1391caa1b05SDavid Kaplan | ``mitigations=[global]`` 1401caa1b05SDavid Kaplan | ``mitigations=[global],[attack vectors]`` 1411caa1b05SDavid Kaplan 1421caa1b05SDavid KaplanGlobal options: 1431caa1b05SDavid Kaplan 1441caa1b05SDavid Kaplan============ ============================================================= 1451caa1b05SDavid KaplanOption Description 1461caa1b05SDavid Kaplan============ ============================================================= 1471caa1b05SDavid Kaplan'off' All attack vectors disabled. 1481caa1b05SDavid Kaplan'auto' All attack vectors enabled, partial cross-thread mitigations. 1491caa1b05SDavid Kaplan'auto,nosmt' All attack vectors enabled, full cross-thread mitigations. 1501caa1b05SDavid Kaplan============ ============================================================= 1511caa1b05SDavid Kaplan 1521caa1b05SDavid KaplanAttack vector options: 1531caa1b05SDavid Kaplan 1541caa1b05SDavid Kaplan================= ======================================= 1551caa1b05SDavid KaplanOption Description 1561caa1b05SDavid Kaplan================= ======================================= 1571caa1b05SDavid Kaplan'no_user_kernel' Disables user-to-kernel mitigations. 1581caa1b05SDavid Kaplan'no_user_user' Disables user-to-user mitigations. 1591caa1b05SDavid Kaplan'no_guest_host' Disables guest-to-host mitigations. 1601caa1b05SDavid Kaplan'no_guest_guest' Disables guest-to-guest mitigations 1611caa1b05SDavid Kaplan'no_cross_thread' Disables all cross-thread mitigations. 1621caa1b05SDavid Kaplan================= ======================================= 1631caa1b05SDavid Kaplan 1641caa1b05SDavid KaplanMultiple attack vector options may be specified in a comma-separated list. If 1651caa1b05SDavid Kaplanthe global option is not specified, it defaults to 'auto'. The global option 1661caa1b05SDavid Kaplan'off' is equivalent to disabling all attack vectors. 1671caa1b05SDavid Kaplan 1681caa1b05SDavid KaplanExamples: 1691caa1b05SDavid Kaplan | ``mitigations=auto,no_user_kernel`` 1701caa1b05SDavid Kaplan 1711caa1b05SDavid Kaplan Enable all attack vectors except user-to-kernel. Partial cross-thread 1721caa1b05SDavid Kaplan mitigations. 1731caa1b05SDavid Kaplan 1741caa1b05SDavid Kaplan | ``mitigations=auto,nosmt,no_guest_host,no_guest_guest`` 1751caa1b05SDavid Kaplan 1761caa1b05SDavid Kaplan Enable all attack vectors and cross-thread mitigations except for 1771caa1b05SDavid Kaplan guest-to-host and guest-to-guest mitigations. 1781caa1b05SDavid Kaplan 1791caa1b05SDavid Kaplan | ``mitigations=,no_cross_thread`` 1801caa1b05SDavid Kaplan 1811caa1b05SDavid Kaplan Enable all attack vectors but not cross-thread mitigations. 1821caa1b05SDavid Kaplan 1831caa1b05SDavid KaplanInteractions with command-line options 1841caa1b05SDavid Kaplan-------------------------------------- 1851caa1b05SDavid Kaplan 1861caa1b05SDavid KaplanVulnerability-specific controls (e.g. "retbleed=off") take precedence over all 1871caa1b05SDavid Kaplanattack vector controls. Mitigations for individual vulnerabilities may be 1881caa1b05SDavid Kaplanturned on or off via their command-line options regardless of the attack vector 1891caa1b05SDavid Kaplancontrols. 1901caa1b05SDavid Kaplan 1911caa1b05SDavid KaplanSummary of attack-vector mitigations 1921caa1b05SDavid Kaplan------------------------------------ 1931caa1b05SDavid Kaplan 1941caa1b05SDavid KaplanWhen a vulnerability is mitigated due to an attack-vector control, the default 1951caa1b05SDavid Kaplanmitigation option for that particular vulnerability is used. To use a different 1961caa1b05SDavid Kaplanmitigation, please use the vulnerability-specific command line option. 1971caa1b05SDavid Kaplan 1981caa1b05SDavid KaplanThe table below summarizes which vulnerabilities are mitigated when different 1991caa1b05SDavid Kaplanattack vectors are enabled and assuming the CPU is vulnerable. 2001caa1b05SDavid Kaplan 2011caa1b05SDavid Kaplan=============== ============== ============ ============= ============== ============ ======== 2021caa1b05SDavid KaplanVulnerability User-to-Kernel User-to-User Guest-to-Host Guest-to-Guest Cross-Thread Notes 2031caa1b05SDavid Kaplan=============== ============== ============ ============= ============== ============ ======== 2041caa1b05SDavid KaplanBHI X X 2051caa1b05SDavid KaplanITS X X 2061caa1b05SDavid KaplanGDS X X X X * (Note 1) 2071caa1b05SDavid KaplanL1TF X X * (Note 2) 2081caa1b05SDavid KaplanMDS X X X X * (Note 2) 2091caa1b05SDavid KaplanMMIO X X X X * (Note 2) 2101caa1b05SDavid KaplanMeltdown X 2111caa1b05SDavid KaplanRetbleed X X * (Note 3) 2121caa1b05SDavid KaplanRFDS X X X X 2131caa1b05SDavid KaplanSpectre_v1 X 2141caa1b05SDavid KaplanSpectre_v2 X X 2151caa1b05SDavid KaplanSpectre_v2_user X X * (Note 1) 2161caa1b05SDavid KaplanSRBDS X X X X 2174fa7d880SDavid KaplanSRSO X X X X 218*8b3641dfSDavid KaplanSSB X 2191caa1b05SDavid KaplanTAA X X X X * (Note 2) 2201caa1b05SDavid KaplanTSA X X X X 2211caa1b05SDavid Kaplan=============== ============== ============ ============= ============== ============ ======== 2221caa1b05SDavid Kaplan 2231caa1b05SDavid KaplanNotes: 2241caa1b05SDavid Kaplan 1 -- Can be mitigated without disabling SMT. 2251caa1b05SDavid Kaplan 2261caa1b05SDavid Kaplan 2 -- Disables SMT if cross-thread mitigations are fully enabled and the CPU 2271caa1b05SDavid Kaplan is vulnerable 2281caa1b05SDavid Kaplan 2291caa1b05SDavid Kaplan 3 -- Disables SMT if cross-thread mitigations are fully enabled, the CPU is 2301caa1b05SDavid Kaplan vulnerable, and STIBP is not supported 2311caa1b05SDavid Kaplan 2321caa1b05SDavid KaplanWhen an attack-vector is disabled, all mitigations for the vulnerabilities 2331caa1b05SDavid Kaplanlisted in the above table are disabled, unless mitigation is required for a 2341caa1b05SDavid Kaplandifferent enabled attack-vector or a mitigation is explicitly selected via a 2351caa1b05SDavid Kaplanvulnerability-specific command line option. 236