]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0279-x86-mm-Set-IBPB-upon-context-switch.patch
de5de85ed9395c1e56feb1a912374924458ba9da
[pve-kernel.git] / patches / kernel / 0279-x86-mm-Set-IBPB-upon-context-switch.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Tim Chen <tim.c.chen@linux.intel.com>
3 Date: Fri, 20 Oct 2017 12:56:29 -0700
4 Subject: [PATCH] x86/mm: Set IBPB upon context switch
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 CVE-2017-5753
10 CVE-2017-5715
11
12 Set IBPB on context switch with changing of page table.
13
14 Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
15 Signed-off-by: Andy Whitcroft <apw@canonical.com>
16 Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
17 (cherry picked from commit a3320203792b633fb96df5d0bbfb7036129b78e2)
18 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
19 ---
20 arch/x86/mm/tlb.c | 4 ++++
21 1 file changed, 4 insertions(+)
22
23 diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
24 index 06f3854d0a4f..bb3ded3a4e5f 100644
25 --- a/arch/x86/mm/tlb.c
26 +++ b/arch/x86/mm/tlb.c
27 @@ -12,6 +12,7 @@
28 #include <asm/cache.h>
29 #include <asm/apic.h>
30 #include <asm/uv/uv.h>
31 +#include <asm/microcode.h>
32 #include <linux/debugfs.h>
33
34 /*
35 @@ -218,6 +219,9 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next,
36 u16 new_asid;
37 bool need_flush;
38
39 + if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
40 + native_wrmsrl(MSR_IA32_PRED_CMD, FEATURE_SET_IBPB);
41 +
42 if (IS_ENABLED(CONFIG_VMAP_STACK)) {
43 /*
44 * If our current stack is in vmalloc space and isn't
45 --
46 2.14.2
47