]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0278-x86-idle-Disable-IBRS-when-offlining-cpu-and-re-enab.patch
8424c28bd1c46f4c65943bc6b055f08e850a2ebc
[pve-kernel.git] / patches / kernel / 0278-x86-idle-Disable-IBRS-when-offlining-cpu-and-re-enab.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Tim Chen <tim.c.chen@linux.intel.com>
3 Date: Wed, 15 Nov 2017 12:24:19 -0800
4 Subject: [PATCH] x86/idle: Disable IBRS when offlining cpu and re-enable on
5 wakeup
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 CVE-2017-5753
11 CVE-2017-5715
12
13 Clear IBRS when cpu is offlined and set it when brining it back online.
14
15 Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
16 Signed-off-by: Andy Whitcroft <apw@canonical.com>
17 Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
18 (cherry picked from commit 9bcf662c1690880b2464fe99d0f58dce53c0d89f)
19 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
20 ---
21 arch/x86/kernel/smpboot.c | 7 +++++++
22 1 file changed, 7 insertions(+)
23
24 diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
25 index 398e8324fea4..a652bff7add4 100644
26 --- a/arch/x86/kernel/smpboot.c
27 +++ b/arch/x86/kernel/smpboot.c
28 @@ -77,6 +77,7 @@
29 #include <asm/i8259.h>
30 #include <asm/realmode.h>
31 #include <asm/misc.h>
32 +#include <asm/microcode.h>
33
34 /* Number of siblings per CPU package */
35 int smp_num_siblings = 1;
36 @@ -1692,9 +1693,15 @@ void native_play_dead(void)
37 play_dead_common();
38 tboot_shutdown(TB_SHUTDOWN_WFS);
39
40 + if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
41 + native_wrmsrl(MSR_IA32_SPEC_CTRL, 0);
42 +
43 mwait_play_dead(); /* Only returns on failure */
44 if (cpuidle_play_dead())
45 hlt_play_dead();
46 +
47 + if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
48 + native_wrmsrl(MSR_IA32_SPEC_CTRL, FEATURE_ENABLE_IBRS);
49 }
50
51 #else /* ... !CONFIG_HOTPLUG_CPU */
52 --
53 2.14.2
54