x86/speculation: Use generic retpoline by default on AMD
authorKim Phillips <kim.phillips@amd.com>
Mon, 28 Feb 2022 17:23:15 +0000 (11:23 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Mar 2022 09:03:31 +0000 (10:03 +0100)
commit 244d00b5dd4755f8df892c86cab35fb2cfd4f14b upstream.

AMD retpoline may be susceptible to speculation. The speculation
execution window for an incorrect indirect branch prediction using
LFENCE/JMP sequence may potentially be large enough to allow
exploitation using Spectre V2.

By default, don't use retpoline,lfence on AMD.  Instead, use the
generic retpoline.

Signed-off-by: Kim Phillips <kim.phillips@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/cpu/bugs.c

index cfcebfa6b53aa17626dcffaaaf5b2c0479077ee4..653990106a156ce9e11ee19dde19a7f94b82b671 100644 (file)
@@ -897,14 +897,6 @@ static enum spectre_v2_mitigation __init spectre_v2_select_retpoline(void)
                return SPECTRE_V2_NONE;
        }
 
-       if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
-               if (!boot_cpu_has(X86_FEATURE_LFENCE_RDTSC)) {
-                       pr_err("LFENCE not serializing, switching to generic retpoline\n");
-                       return SPECTRE_V2_RETPOLINE;
-               }
-               return SPECTRE_V2_LFENCE;
-       }
-
        return SPECTRE_V2_RETPOLINE;
 }