Skip to content

Commit 6cf6335

Browse files
leitaoaloktiwa
authored andcommitted
Revert "x86/bugs: Make spectre user default depend on MITIGATION_SPECTRE_V2" on v6.6 and older
This reverts commit a8c22ec36cdd99c1002d7152f859798fef7c4d58 which is commit 98fdaeb upstream. commit 7adb96687ce8 ("x86/bugs: Make spectre user default depend on MITIGATION_SPECTRE_V2") depends on commit 72c70f4 ("x86/bugs: Add a separate config for Spectre V2"), which introduced MITIGATION_SPECTRE_V2. commit 72c70f4 ("x86/bugs: Add a separate config for Spectre V2") never landed in stable tree, thus, stable tree doesn't have MITIGATION_SPECTRE_V2, that said, commit 7adb96687ce8 ("x86/bugs: Make spectre user default depend on MITIGATION_SPECTRE_V2") has no value if the dependecy was not applied. Revert commit 7adb96687ce8 ("x86/bugs: Make spectre user default depend on MITIGATION_SPECTRE_V2") in stable kernel which landed in in 5.4.294, 5.10.238, 5.15.185, 6.1.141 and 6.6.93 stable versions. Cc: David.Kaplan@amd.com Cc: peterz@infradead.org Cc: pawan.kumar.gupta@linux.intel.com Cc: mingo@kernel.org Cc: brad.spengler@opensrcsec.com Cc: stable@vger.kernel.org # 6.6 6.1 5.15 5.10 5.4 Reported-by: Brad Spengler <brad.spengler@opensrcsec.com> Reported-by: Salvatore Bonaccorso <carnil@debian.org> Signed-off-by: Breno Leitao <leitao@debian.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit a8b7347f5e752d51fc01ce0b63e1882fbde754f8) FOF: 0825 Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
1 parent cff953e commit 6cf6335

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4718,8 +4718,6 @@
47184718

47194719
Selecting 'on' will also enable the mitigation
47204720
against user space to user space task attacks.
4721-
Selecting specific mitigation does not force enable
4722-
user mitigations.
47234721

47244722
Selecting 'off' will disable both the kernel and
47254723
the user space protections.

arch/x86/kernel/cpu/bugs.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,13 +1686,9 @@ static enum spectre_v2_mitigation_cmd spectre_v2_cmd;
16861686
static enum spectre_v2_user_cmd
16871687
spectre_v2_parse_user_cmdline(void)
16881688
{
1689-
enum spectre_v2_user_cmd mode;
16901689
char arg[20];
16911690
int ret, i;
16921691

1693-
mode = IS_ENABLED(CONFIG_MITIGATION_SPECTRE_V2) ?
1694-
SPECTRE_V2_USER_CMD_AUTO : SPECTRE_V2_USER_CMD_NONE;
1695-
16961692
switch (spectre_v2_cmd) {
16971693
case SPECTRE_V2_CMD_NONE:
16981694
return SPECTRE_V2_USER_CMD_NONE;
@@ -1705,7 +1701,7 @@ spectre_v2_parse_user_cmdline(void)
17051701
ret = cmdline_find_option(saved_command_line, "spectre_v2_user",
17061702
arg, sizeof(arg));
17071703
if (ret < 0)
1708-
return mode;
1704+
return SPECTRE_V2_USER_CMD_AUTO;
17091705

17101706
for (i = 0; i < ARRAY_SIZE(v2_user_options); i++) {
17111707
if (match_option(arg, ret, v2_user_options[i].option)) {
@@ -1715,8 +1711,8 @@ spectre_v2_parse_user_cmdline(void)
17151711
}
17161712
}
17171713

1718-
pr_err("Unknown user space protection option (%s). Switching to default\n", arg);
1719-
return mode;
1714+
pr_err("Unknown user space protection option (%s). Switching to AUTO select\n", arg);
1715+
return SPECTRE_V2_USER_CMD_AUTO;
17201716
}
17211717

17221718
static inline bool spectre_v2_in_eibrs_mode(enum spectre_v2_mitigation mode)

0 commit comments

Comments
 (0)