From: Konrad Rzeszutek Wilk Date: Sat, 10 Feb 2018 04:16:09 +0000 (-0500) Subject: x86/spectre_v2: Only use IBRS when ibrs_inuse tells us to X-Git-Tag: v4.1.12-124.31.3~1135 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=79e253dddafcda1d23403e5250526dc4cbd3fc75;p=users%2Fjedix%2Flinux-maple.git x86/spectre_v2: Only use IBRS when ibrs_inuse tells us to instead of using it if the CPU has detected that it exists. This conflicts with retpoline - as when retpoline is enabled we end up enabling/disabling the IBRS even though we should not be touching this MSR. OraBug: 27526563 Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: Jack Vogel --- diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 0d9fa5311f9a..9f60bcbf85ca 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -463,17 +463,17 @@ static __cpuidle void mwait_idle(void) smp_mb(); /* quirk */ } - if (boot_cpu_has(X86_FEATURE_IBRS)) + if (ibrs_inuse) native_wrmsrl(MSR_IA32_SPEC_CTRL, SPEC_CTRL_FEATURE_DISABLE_IBRS); __monitor((void *)¤t_thread_info()->flags, 0, 0); if (!need_resched()) { __sti_mwait(0, 0); - if (boot_cpu_has(X86_FEATURE_IBRS)) + if (ibrs_inuse) native_wrmsrl(MSR_IA32_SPEC_CTRL, SPEC_CTRL_FEATURE_ENABLE_IBRS); } else { - if (boot_cpu_has(X86_FEATURE_IBRS)) + if (ibrs_inuse) native_wrmsrl(MSR_IA32_SPEC_CTRL, SPEC_CTRL_FEATURE_ENABLE_IBRS); local_irq_enable(); }