All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 00/36] Attack vector controls
@ 2025-03-10 16:39 David Kaplan
  2025-03-10 16:39 ` [PATCH v4 01/36] x86/bugs: Restructure mds mitigation David Kaplan
                   ` (36 more replies)
  0 siblings, 37 replies; 76+ messages in thread
From: David Kaplan @ 2025-03-10 16:39 UTC (permalink / raw)
  To: Thomas Gleixner, Borislav Petkov, Peter Zijlstra, Josh Poimboeuf,
	Pawan Gupta, Ingo Molnar, Dave Hansen, x86, H . Peter Anvin
  Cc: linux-kernel, Brendan Jackman, Derek Manwaring

This series 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.

There are two parts to this patch series:

The first 16 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" 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.

In this series, attack vector options are chosen using the mitigations=
command line.  Attack vectors may be individually disabled such as
'mitigations=auto;no_user_kernel,no_user_user'.  The 'mitigations=off'
option is equivalent to disabling all attack vectors.  'mitigations=off'
therefore disables all mitigations, unless bug-specific command line
options are used to re-enable some.

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

Changes in v4:
   - New command line interface for attack vector selection
   - Rework of smt mitigations into on/auto/off
   - Print mitigated attack vectors in dmesg and sysfs
   - Various bug fixes and clean up

Changes in v3:
   - Moved command line options to be x86-only
   - Fix bugs related to ucode detection for taa/mmio/rfds
   - Various clean up

Changes in v2:
   - Removed new enum, just use X86_BUG* to identify vulnerabilities
   - Mitigate gds if cross-thread protection is selected as pointed out
     by Andrew Cooper
   - Simplifications around verw-based mitigation handling
   - Various bug fixes

David Kaplan (36):
  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: Only allow retbleed=stuff on Intel
  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
  cpu: Define attack vectors
  x86/Kconfig: Arch attack vector support
  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
  x86/bugs: Print enabled attack vectors
  cpu: Show attack vectors in sysfs

 .../hw-vuln/attack_vector_controls.rst        |  236 +++
 Documentation/admin-guide/hw-vuln/index.rst   |    1 +
 arch/Kconfig                                  |    3 +
 arch/x86/Kconfig                              |    1 +
 arch/x86/include/asm/processor.h              |    1 +
 arch/x86/kernel/cpu/bugs.c                    | 1302 ++++++++++-------
 arch/x86/kvm/vmx/vmx.c                        |    2 +
 arch/x86/mm/pti.c                             |    4 +-
 drivers/base/cpu.c                            |   67 +
 include/linux/cpu.h                           |   20 +
 kernel/cpu.c                                  |  129 +-
 11 files changed, 1248 insertions(+), 518 deletions(-)
 create mode 100644 Documentation/admin-guide/hw-vuln/attack_vector_controls.rst

-- 
2.34.1


^ permalink raw reply	[flat|nested] 76+ messages in thread

end of thread, other threads:[~2025-04-15 17:06 UTC | newest]

Thread overview: 76+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-10 16:39 [PATCH v4 00/36] Attack vector controls David Kaplan
2025-03-10 16:39 ` [PATCH v4 01/36] x86/bugs: Restructure mds mitigation David Kaplan
2025-03-10 16:39 ` [PATCH v4 02/36] x86/bugs: Restructure taa mitigation David Kaplan
2025-03-10 16:39 ` [PATCH v4 03/36] x86/bugs: Restructure mmio mitigation David Kaplan
2025-03-13  9:36   ` Borislav Petkov
2025-03-13 14:19     ` Kaplan, David
2025-03-13 19:26     ` Pawan Gupta
2025-03-18 14:16       ` MMIO and VERW Borislav Petkov
2025-03-18 16:25         ` Pawan Gupta
2025-03-18 16:34           ` Borislav Petkov
2025-03-18 16:56             ` Pawan Gupta
2025-03-18 17:37               ` Borislav Petkov
2025-03-18 18:15                 ` Pawan Gupta
2025-03-18 18:55                   ` Borislav Petkov
2025-03-24  9:29       ` [PATCH v4 03/36] x86/bugs: Restructure mmio mitigation Borislav Petkov
2025-03-24 17:41         ` Pawan Gupta
2025-03-25 11:31           ` Borislav Petkov
2025-03-10 16:39 ` [PATCH v4 04/36] x86/bugs: Restructure rfds mitigation David Kaplan
2025-04-10 16:24   ` Josh Poimboeuf
2025-04-14 19:10     ` Kaplan, David
2025-03-10 16:39 ` [PATCH v4 05/36] x86/bugs: Remove md_clear_*_mitigation() David Kaplan
2025-03-10 16:39 ` [PATCH v4 06/36] x86/bugs: Restructure srbds mitigation David Kaplan
2025-03-10 16:39 ` [PATCH v4 07/36] x86/bugs: Restructure gds mitigation David Kaplan
2025-03-10 16:39 ` [PATCH v4 08/36] x86/bugs: Restructure spectre_v1 mitigation David Kaplan
2025-03-10 16:39 ` [PATCH v4 09/36] x86/bugs: Only allow retbleed=stuff on Intel David Kaplan
2025-03-10 16:39 ` [PATCH v4 10/36] x86/bugs: Restructure retbleed mitigation David Kaplan
2025-03-10 16:39 ` [PATCH v4 11/36] x86/bugs: Restructure spectre_v2_user mitigation David Kaplan
2025-03-12  9:49   ` kernel test robot
2025-04-10 16:26   ` Josh Poimboeuf
2025-04-14 19:20     ` Kaplan, David
2025-04-10 16:41   ` Josh Poimboeuf
2025-04-14 19:20     ` Kaplan, David
2025-04-14 23:48       ` Josh Poimboeuf
2025-04-15 14:56         ` Kaplan, David
2025-03-10 16:39 ` [PATCH v4 12/36] x86/bugs: Restructure bhi mitigation David Kaplan
2025-03-10 16:40 ` [PATCH v4 13/36] x86/bugs: Restructure spectre_v2 mitigation David Kaplan
2025-04-10 17:08   ` Josh Poimboeuf
2025-04-14 19:25     ` Kaplan, David
2025-03-10 16:40 ` [PATCH v4 14/36] x86/bugs: Restructure ssb mitigation David Kaplan
2025-03-10 16:40 ` [PATCH v4 15/36] x86/bugs: Restructure l1tf mitigation David Kaplan
2025-03-10 16:40 ` [PATCH v4 16/36] x86/bugs: Restructure srso mitigation David Kaplan
2025-04-10 17:38   ` Josh Poimboeuf
2025-04-14 21:12     ` Kaplan, David
2025-03-10 16:40 ` [PATCH v4 17/36] Documentation/x86: Document the new attack vector controls David Kaplan
2025-04-10 18:14   ` Josh Poimboeuf
2025-04-14 21:15     ` Kaplan, David
2025-04-14 23:51       ` Josh Poimboeuf
2025-04-15 14:59         ` Kaplan, David
2025-04-15 15:32           ` Josh Poimboeuf
2025-04-15 16:10             ` Kaplan, David
2025-04-15 16:47               ` Josh Poimboeuf
2025-04-15 17:06                 ` Kaplan, David
2025-03-10 16:40 ` [PATCH v4 18/36] cpu: Define attack vectors David Kaplan
2025-04-10 18:12   ` Josh Poimboeuf
2025-04-14 21:20     ` Kaplan, David
2025-03-10 16:40 ` [PATCH v4 19/36] x86/Kconfig: Arch attack vector support David Kaplan
2025-03-10 16:40 ` [PATCH v4 20/36] x86/bugs: Determine relevant vulnerabilities based on attack vector controls David Kaplan
2025-03-12 11:32   ` kernel test robot
2025-03-10 16:40 ` [PATCH v4 21/36] x86/bugs: Add attack vector controls for mds David Kaplan
2025-03-10 16:40 ` [PATCH v4 22/36] x86/bugs: Add attack vector controls for taa David Kaplan
2025-03-10 16:40 ` [PATCH v4 23/36] x86/bugs: Add attack vector controls for mmio David Kaplan
2025-03-10 16:40 ` [PATCH v4 24/36] x86/bugs: Add attack vector controls for rfds David Kaplan
2025-03-10 16:40 ` [PATCH v4 25/36] x86/bugs: Add attack vector controls for srbds David Kaplan
2025-03-10 16:40 ` [PATCH v4 26/36] x86/bugs: Add attack vector controls for gds David Kaplan
2025-03-10 16:40 ` [PATCH v4 27/36] x86/bugs: Add attack vector controls for spectre_v1 David Kaplan
2025-03-10 16:40 ` [PATCH v4 28/36] x86/bugs: Add attack vector controls for retbleed David Kaplan
2025-03-10 16:40 ` [PATCH v4 29/36] x86/bugs: Add attack vector controls for spectre_v2_user David Kaplan
2025-03-10 16:40 ` [PATCH v4 30/36] x86/bugs: Add attack vector controls for bhi David Kaplan
2025-03-10 16:40 ` [PATCH v4 31/36] x86/bugs: Add attack vector controls for spectre_v2 David Kaplan
2025-03-10 16:40 ` [PATCH v4 32/36] x86/bugs: Add attack vector controls for l1tf David Kaplan
2025-03-10 16:40 ` [PATCH v4 33/36] x86/bugs: Add attack vector controls for srso David Kaplan
2025-03-10 16:40 ` [PATCH v4 34/36] x86/pti: Add attack vector controls for pti David Kaplan
2025-03-10 16:40 ` [PATCH v4 35/36] x86/bugs: Print enabled attack vectors David Kaplan
2025-03-10 16:40 ` [PATCH v4 36/36] cpu: Show attack vectors in sysfs David Kaplan
2025-03-10 18:45 ` [PATCH v4 00/36] Attack vector controls Ingo Molnar
2025-03-10 20:46   ` Kaplan, David

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.