Skip to content

Commit 9404556

Browse files
leitaobp3tk0v
authored andcommitted
x86/bugs: Add a separate config for MDS
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 MDS CPU mitigation under CONFIG_SPECULATION_MITIGATIONS. This allow users to enable or disable it at compilation time. Signed-off-by: Breno Leitao <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 8400291 commit 9404556

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

arch/x86/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,6 +2650,15 @@ config MITIGATION_SPECTRE_BHI
26502650
indirect branches.
26512651
See <file:Documentation/admin-guide/hw-vuln/spectre.rst>
26522652

2653+
config MITIGATION_MDS
2654+
bool "Mitigate Microarchitectural Data Sampling (MDS) hardware bug"
2655+
depends on CPU_SUP_INTEL
2656+
default y
2657+
help
2658+
Enable mitigation for Microarchitectural Data Sampling (MDS). MDS is
2659+
a hardware vulnerability which allows unprivileged speculative access
2660+
to data which is available in various CPU internal buffers.
2661+
See also <file:Documentation/admin-guide/hw-vuln/mds.rst>
26532662
endif
26542663

26552664
config ARCH_HAS_ADD_PAGES

arch/x86/kernel/cpu/bugs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ static void x86_amd_ssb_disable(void)
233233
#define pr_fmt(fmt) "MDS: " fmt
234234

235235
/* Default mitigation for MDS-affected CPUs */
236-
static enum mds_mitigations mds_mitigation __ro_after_init = MDS_MITIGATION_FULL;
236+
static enum mds_mitigations mds_mitigation __ro_after_init =
237+
IS_ENABLED(CONFIG_MITIGATION_MDS) ? MDS_MITIGATION_FULL : MDS_MITIGATION_OFF;
237238
static bool mds_nosmt __ro_after_init = false;
238239

239240
static const char * const mds_strings[] = {

0 commit comments

Comments
 (0)