From: Konrad Rzeszutek Wilk Date: Thu, 1 Feb 2018 17:16:10 +0000 (-0500) Subject: x86/spectre: Fix retpoline_enabled X-Git-Tag: v4.1.12-124.31.3~1165 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ccdb54f5c9d885eefff9325e5aab275127ee9090;p=users%2Fjedix%2Flinux-maple.git x86/spectre: Fix retpoline_enabled As it will report that retpoline_enabled if IBRS is set. Instead just figure out which mode we are in and if it has retpoline then return true. Orabug: 27477743 CVE: CVE-2017-5715 Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: Darren Kenny Reviewed-by: Pavel Tatashin --- diff --git a/arch/x86/kernel/cpu/bugs_64.c b/arch/x86/kernel/cpu/bugs_64.c index 719344592677..dc062b3e5597 100644 --- a/arch/x86/kernel/cpu/bugs_64.c +++ b/arch/x86/kernel/cpu/bugs_64.c @@ -121,7 +121,17 @@ void disable_retpoline(void) bool retpoline_enabled(void) { - return spectre_v2_enabled != SPECTRE_V2_NONE; + switch (spectre_v2_enabled) { + case SPECTRE_V2_RETPOLINE_MINIMAL: + case SPECTRE_V2_RETPOLINE_MINIMAL_AMD: + case SPECTRE_V2_RETPOLINE_GENERIC: + case SPECTRE_V2_RETPOLINE_AMD: + return true; + default: + break; + } + + return false; } static void __init spec2_print_if_insecure(const char *reason)