Skip to content

Commit 225f2bd

Browse files
leitaobp3tk0v
authored andcommitted
x86/bugs: Add a separate config for GDS
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 a new kernel config that allows GDS to be completely disabled, similarly to the "gather_data_sampling=off" or "mitigations=off" kernel command-line. Now, there are two options for GDS mitigation: * CONFIG_MITIGATION_GDS=n -> Mitigation disabled (New) * CONFIG_MITIGATION_GDS=y -> Mitigation enabled (GDS_MITIGATION_FULL) Suggested-by: Josh Poimboeuf <[email protected]> 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 03267a5 commit 225f2bd

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

arch/x86/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2610,6 +2610,16 @@ config MITIGATION_SLS
26102610
against straight line speculation. The kernel image might be slightly
26112611
larger.
26122612

2613+
config MITIGATION_GDS
2614+
bool "Mitigate Gather Data Sampling"
2615+
depends on CPU_SUP_INTEL
2616+
default y
2617+
help
2618+
Enable mitigation for Gather Data Sampling (GDS). GDS is a hardware
2619+
vulnerability which allows unprivileged speculative access to data
2620+
which was previously stored in vector registers. The attacker uses gather
2621+
instructions to infer the stale vector register data.
2622+
26132623
config MITIGATION_RFDS
26142624
bool "RFDS Mitigation"
26152625
depends on CPU_SUP_INTEL

arch/x86/kernel/cpu/bugs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,8 @@ enum gds_mitigations {
735735
GDS_MITIGATION_HYPERVISOR,
736736
};
737737

738-
static enum gds_mitigations gds_mitigation __ro_after_init = GDS_MITIGATION_FULL;
738+
static enum gds_mitigations gds_mitigation __ro_after_init =
739+
IS_ENABLED(CONFIG_MITIGATION_GDS) ? GDS_MITIGATION_FULL : GDS_MITIGATION_OFF;
739740

740741
static const char * const gds_strings[] = {
741742
[GDS_MITIGATION_OFF] = "Vulnerable",

0 commit comments

Comments
 (0)