Skip to content

Commit c04579e

Browse files
Daniel Sneddongregkh
authored andcommitted
x86/speculation: Add Kconfig option for GDS
commit 53cf579 upstream Gather Data Sampling (GDS) is mitigated in microcode. However, on systems that haven't received the updated microcode, disabling AVX can act as a mitigation. Add a Kconfig option that uses the microcode mitigation if available and disables AVX otherwise. Setting this option has no effect on systems not affected by GDS. This is the equivalent of setting gather_data_sampling=force. Signed-off-by: Daniel Sneddon <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Signed-off-by: Daniel Sneddon <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 92fc27c commit c04579e

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

arch/x86/Kconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2522,6 +2522,25 @@ config SLS
25222522
against straight line speculation. The kernel image might be slightly
25232523
larger.
25242524

2525+
config GDS_FORCE_MITIGATION
2526+
bool "Force GDS Mitigation"
2527+
depends on CPU_SUP_INTEL
2528+
default n
2529+
help
2530+
Gather Data Sampling (GDS) is a hardware vulnerability which allows
2531+
unprivileged speculative access to data which was previously stored in
2532+
vector registers.
2533+
2534+
This option is equivalent to setting gather_data_sampling=force on the
2535+
command line. The microcode mitigation is used if present, otherwise
2536+
AVX is disabled as a mitigation. On affected systems that are missing
2537+
the microcode any userspace code that unconditionally uses AVX will
2538+
break with this option set.
2539+
2540+
Setting this option on systems not vulnerable to GDS has no effect.
2541+
2542+
If in doubt, say N.
2543+
25252544
endif
25262545

25272546
config ARCH_HAS_ADD_PAGES

arch/x86/kernel/cpu/bugs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,11 @@ enum gds_mitigations {
658658
GDS_MITIGATION_HYPERVISOR,
659659
};
660660

661+
#if IS_ENABLED(CONFIG_GDS_FORCE_MITIGATION)
662+
static enum gds_mitigations gds_mitigation __ro_after_init = GDS_MITIGATION_FORCE;
663+
#else
661664
static enum gds_mitigations gds_mitigation __ro_after_init = GDS_MITIGATION_FULL;
665+
#endif
662666

663667
static const char * const gds_strings[] = {
664668
[GDS_MITIGATION_OFF] = "Vulnerable",

0 commit comments

Comments
 (0)