OSDN Git Service

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)
committerBorislav Petkov <bp@suse.de>
Mon, 28 Feb 2022 17:37:08 +0000 (18:37 +0100)
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>
arch/x86/kernel/cpu/bugs.c

index 0a4267c..a36bfe2 100644 (file)
@@ -941,15 +941,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 ||
-           boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
-               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;
 }