]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Revert "x86/bugs: Make spectre user default depend on MITIGATION_SPECTRE_V2" on v6...
authorBreno Leitao <leitao@debian.org>
Fri, 20 Jun 2025 13:51:23 +0000 (06:51 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:05:33 +0000 (11:05 +0100)
This reverts commit 4fc2d289b3cc4cf23ccabe59cf936d1dc49aeda8 which is
commit 98fdaeb296f51ef08e727a7cc72e5b5c864c4f4d upstream.

commit 7adb96687ce8 ("x86/bugs: Make spectre user default depend on
MITIGATION_SPECTRE_V2") depends on commit 72c70f480a70 ("x86/bugs: Add
a separate config for Spectre V2"), which introduced
MITIGATION_SPECTRE_V2.

commit 72c70f480a70 ("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>
Documentation/admin-guide/kernel-parameters.txt
arch/x86/kernel/cpu/bugs.c

index e0670357d23f8d39d1a93d7e7f65a06f4628f8da..4bc5d8c97d097b3ee6b8ff99f3958429f0352e59 100644 (file)
 
                        Selecting 'on' will also enable the mitigation
                        against user space to user space task attacks.
-                       Selecting specific mitigation does not force enable
-                       user mitigations.
 
                        Selecting 'off' will disable both the kernel and
                        the user space protections.
index 30b9292ac58fdefdf042ea11e1f9e6c74b7cd238..63af3d73d19e5d83b16fef8c3fc9aa6e13dda832 100644 (file)
@@ -1382,13 +1382,9 @@ static __ro_after_init enum spectre_v2_mitigation_cmd spectre_v2_cmd;
 static enum spectre_v2_user_cmd __init
 spectre_v2_parse_user_cmdline(void)
 {
-       enum spectre_v2_user_cmd mode;
        char arg[20];
        int ret, i;
 
-       mode = IS_ENABLED(CONFIG_MITIGATION_SPECTRE_V2) ?
-               SPECTRE_V2_USER_CMD_AUTO : SPECTRE_V2_USER_CMD_NONE;
-
        switch (spectre_v2_cmd) {
        case SPECTRE_V2_CMD_NONE:
                return SPECTRE_V2_USER_CMD_NONE;
@@ -1401,7 +1397,7 @@ spectre_v2_parse_user_cmdline(void)
        ret = cmdline_find_option(boot_command_line, "spectre_v2_user",
                                  arg, sizeof(arg));
        if (ret < 0)
-               return mode;
+               return SPECTRE_V2_USER_CMD_AUTO;
 
        for (i = 0; i < ARRAY_SIZE(v2_user_options); i++) {
                if (match_option(arg, ret, v2_user_options[i].option)) {
@@ -1411,8 +1407,8 @@ spectre_v2_parse_user_cmdline(void)
                }
        }
 
-       pr_err("Unknown user space protection option (%s). Switching to default\n", arg);
-       return mode;
+       pr_err("Unknown user space protection option (%s). Switching to AUTO select\n", arg);
+       return SPECTRE_V2_USER_CMD_AUTO;
 }
 
 static inline bool spectre_v2_in_eibrs_mode(enum spectre_v2_mitigation mode)