]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
x86/bugs: Add a separate config for SRBDS
authorBreno Leitao <leitao@debian.org>
Mon, 29 Jul 2024 16:40:55 +0000 (09:40 -0700)
committerBorislav Petkov (AMD) <bp@alien8.de>
Tue, 30 Jul 2024 12:49:53 +0000 (14:49 +0200)
Currently, the CONFIG_SPECULATION_MITIGATIONS is halfway populated,
where some mitigations have entries in Kconfig, and they could be
modified, while others mitigations do not have Kconfig entries, and
could not be controlled at build time.

Create an entry for the SRBDS CPU mitigation under
CONFIG_SPECULATION_MITIGATIONS. This allow users to enable or disable
it at compilation time.

Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://lore.kernel.org/r/20240729164105.554296-8-leitao@debian.org
arch/x86/Kconfig
arch/x86/kernel/cpu/bugs.c

index e3c63e5208abe7e954e4c326024d5f06ce17a29f..22d324581a601ab4340c74b8db17d2c5c4c02bdb 100644 (file)
@@ -2715,6 +2715,20 @@ config MITIGATION_SPECTRE_V1
          execution that bypasses conditional branch instructions used for
          memory access bounds check.
          See also <file:Documentation/admin-guide/hw-vuln/spectre.rst>
+
+config MITIGATION_SRBDS
+       bool "Mitigate Special Register Buffer Data Sampling (SRBDS) hardware bug"
+       depends on CPU_SUP_INTEL
+       default y
+       help
+         Enable mitigation for Special Register Buffer Data Sampling (SRBDS).
+         SRBDS is a hardware vulnerability that allows Microarchitectural Data
+         Sampling (MDS) techniques to infer values returned from special
+         register accesses. An unprivileged user can extract values returned
+         from RDRAND and RDSEED executed on another core or sibling thread
+         using MDS techniques.
+         See also
+         <file:Documentation/admin-guide/hw-vuln/special-register-buffer-data-sampling.rst>
 endif
 
 config ARCH_HAS_ADD_PAGES
index ebb6a2f578d16a4a8f7e44b828931e4fcc0202fb..8292a96d376cfe0684842d50f4eabcd7b3fca478 100644 (file)
@@ -608,7 +608,8 @@ enum srbds_mitigations {
        SRBDS_MITIGATION_HYPERVISOR,
 };
 
-static enum srbds_mitigations srbds_mitigation __ro_after_init = SRBDS_MITIGATION_FULL;
+static enum srbds_mitigations srbds_mitigation __ro_after_init =
+       IS_ENABLED(CONFIG_MITIGATION_SRBDS) ? SRBDS_MITIGATION_FULL : SRBDS_MITIGATION_OFF;
 
 static const char * const srbds_strings[] = {
        [SRBDS_MITIGATION_OFF]          = "Vulnerable",