[RFC PATCH 00/34] x86/bugs: Attack vector controls

From: David Kaplan
Date: Thu Sep 12 2024 - 15:09:25 EST


This RFC restructures arch/x86/kernel/cpu/bugs.c and proposes new
command line options to make it easier to control which CPU mitigations
are applied. These options select relevant mitigations based on chosen
attack vectors, which are hopefully easier for users to understand.

This patch series will also be part of a discussion at the LPC x86
microconference next week.

There are two parts to this patch series:

The first 17 patches restructure the existing mitigation selection logic
to use a uniform set of functions. First, the "select" function is
called for each mitigation to select an appropriate mitigation. Unless
a mitigation is explicitly selected or disabled with a command line
option, the default mitigation is AUTO and the "select" function will
then choose the best mitigation. After the "select" function is called
for each mitigation, some mitigations define an "update" function which
can be used to update the selection, based on the choices made by other
mitigations. Finally, the "apply" function is called which enables the
chosen mitigation.

This structure simplifies the mitigation control logic, especially when
there are dependencies between multiple vulnerabilities. It also
prepares the code for the second set of patches.

The rest of the patches define new "attack vector" command line options
to make it easier to select appropriate mitigations based on the usage
of the system. While many users may not be intimately familiar with the
details of these CPU vulnerabilities, they are likely better able to
understand the intended usage of their system. As a result, unneeded
mitigations may be disabled, allowing users to recoup more performance.
New documentation is included with recommendations on what to consider
when choosing which attack vectors to enable/disable.

Note that this patch series does not change any of the existing
mitigation defaults.

David Kaplan (34):
x86/bugs: Relocate mds/taa/mmio/rfds defines
x86/bugs: Add AUTO mitigations for mds/taa/mmio/rfds
x86/bugs: Restructure mds mitigation
x86/bugs: Restructure taa mitigation
x86/bugs: Restructure mmio mitigation
x86/bugs: Restructure rfds mitigation
x86/bugs: Remove md_clear_*_mitigation()
x86/bugs: Restructure srbds mitigation
x86/bugs: Restructure gds mitigation
x86/bugs: Restructure spectre_v1 mitigation
x86/bugs: Restructure retbleed mitigation
x86/bugs: Restructure spectre_v2_user mitigation
x86/bugs: Restructure bhi mitigation
x86/bugs: Restructure spectre_v2 mitigation
x86/bugs: Restructure ssb mitigation
x86/bugs: Restructure l1tf mitigation
x86/bugs: Restructure srso mitigation
Documentation/x86: Document the new attack vector controls
x86/bugs: Define attack vectors
x86/bugs: Determine relevant vulnerabilities based on attack vector
controls.
x86/bugs: Add attack vector controls for mds
x86/bugs: Add attack vector controls for taa
x86/bugs: Add attack vector controls for mmio
x86/bugs: Add attack vector controls for rfds
x86/bugs: Add attack vector controls for srbds
x86/bugs: Add attack vector controls for gds
x86/bugs: Add attack vector controls for spectre_v1
x86/bugs: Add attack vector controls for retbleed
x86/bugs: Add attack vector controls for spectre_v2_user
x86/bugs: Add attack vector controls for bhi
x86/bugs: Add attack vector controls for spectre_v2
x86/bugs: Add attack vector controls for l1tf
x86/bugs: Add attack vector controls for srso
x86/pti: Add attack vector controls for pti

.../hw-vuln/attack_vector_controls.rst | 172 +++
Documentation/admin-guide/hw-vuln/index.rst | 1 +
arch/x86/include/asm/processor.h | 2 +
arch/x86/kernel/cpu/bugs.c | 1171 ++++++++++-------
arch/x86/mm/pti.c | 3 +-
include/linux/cpu.h | 11 +
kernel/cpu.c | 58 +
7 files changed, 977 insertions(+), 441 deletions(-)
create mode 100644 Documentation/admin-guide/hw-vuln/attack_vector_controls.rst

--
2.34.1