From: Tim Chen Date: Fri, 22 Dec 2017 01:24:24 +0000 (-0500) Subject: x86/idle: Disable IBRS when offlining cpu and re-enable on wakeup X-Git-Tag: v4.1.12-124.31.3~1410 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=4963d177f90d0ce4a63c0dcdb86acc9fd4919fca;p=users%2Fjedix%2Flinux-maple.git x86/idle: Disable IBRS when offlining cpu and re-enable on wakeup Clear IBRS when cpu is offlined and set it when bringing it back online. Orabug: 27344012 CVE: CVE-2017-5715 Signed-off-by: Tim Chen Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: John Haxby Signed-off-by: Kirtikar Kashyap --- diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 757546dffb0b..9495f5efdf87 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -76,6 +76,7 @@ #include #include #include +#include /* Number of siblings per CPU package */ int smp_num_siblings = 1; @@ -1504,9 +1505,15 @@ void native_play_dead(void) play_dead_common(); tboot_shutdown(TB_SHUTDOWN_WFS); + if (boot_cpu_has(X86_FEATURE_SPEC_CTRL)) + native_wrmsrl(MSR_IA32_SPEC_CTRL, 0); + mwait_play_dead(); /* Only returns on failure */ if (cpuidle_play_dead()) hlt_play_dead(); + + if (boot_cpu_has(X86_FEATURE_SPEC_CTRL)) + native_wrmsrl(MSR_IA32_SPEC_CTRL, FEATURE_ENABLE_IBRS); } #else /* ... !CONFIG_HOTPLUG_CPU */