Skip to content

Commit b908cda

Browse files
leitaobp3tk0v
authored andcommitted
x86/bugs: Add a separate config for SSB
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 SSB 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 72c70f4 commit b908cda

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

arch/x86/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,6 +2741,16 @@ config MITIGATION_SRBDS
27412741
using MDS techniques.
27422742
See also
27432743
<file:Documentation/admin-guide/hw-vuln/special-register-buffer-data-sampling.rst>
2744+
2745+
config MITIGATION_SSB
2746+
bool "Mitigate Speculative Store Bypass (SSB) hardware bug"
2747+
default y
2748+
help
2749+
Enable mitigation for Speculative Store Bypass (SSB). SSB is a
2750+
hardware security vulnerability and its exploitation takes advantage
2751+
of speculative execution in a similar way to the Meltdown and Spectre
2752+
security vulnerabilities.
2753+
27442754
endif
27452755

27462756
config ARCH_HAS_ADD_PAGES

arch/x86/kernel/cpu/bugs.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2027,18 +2027,20 @@ static const struct {
20272027

20282028
static enum ssb_mitigation_cmd __init ssb_parse_cmdline(void)
20292029
{
2030-
enum ssb_mitigation_cmd cmd = SPEC_STORE_BYPASS_CMD_AUTO;
2030+
enum ssb_mitigation_cmd cmd;
20312031
char arg[20];
20322032
int ret, i;
20332033

2034+
cmd = IS_ENABLED(CONFIG_MITIGATION_SSB) ?
2035+
SPEC_STORE_BYPASS_CMD_AUTO : SPEC_STORE_BYPASS_CMD_NONE;
20342036
if (cmdline_find_option_bool(boot_command_line, "nospec_store_bypass_disable") ||
20352037
cpu_mitigations_off()) {
20362038
return SPEC_STORE_BYPASS_CMD_NONE;
20372039
} else {
20382040
ret = cmdline_find_option(boot_command_line, "spec_store_bypass_disable",
20392041
arg, sizeof(arg));
20402042
if (ret < 0)
2041-
return SPEC_STORE_BYPASS_CMD_AUTO;
2043+
return cmd;
20422044

20432045
for (i = 0; i < ARRAY_SIZE(ssb_mitigation_options); i++) {
20442046
if (!match_option(arg, ret, ssb_mitigation_options[i].option))
@@ -2049,8 +2051,8 @@ static enum ssb_mitigation_cmd __init ssb_parse_cmdline(void)
20492051
}
20502052

20512053
if (i >= ARRAY_SIZE(ssb_mitigation_options)) {
2052-
pr_err("unknown option (%s). Switching to AUTO select\n", arg);
2053-
return SPEC_STORE_BYPASS_CMD_AUTO;
2054+
pr_err("unknown option (%s). Switching to default mode\n", arg);
2055+
return cmd;
20542056
}
20552057
}
20562058

0 commit comments

Comments
 (0)