Skip to content

Commit

Permalink
x86/speculation: Use generic retpoline by default on AMD
Browse files Browse the repository at this point in the history
commit 244d00b 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
kimphillamd authored and gregkh committed Mar 11, 2022
1 parent 316e4a1 commit a56566d
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions arch/x86/kernel/cpu/bugs.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit a56566d

Please sign in to comment.