]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0252-x86-cpufeatures-Add-X86_BUG_SPECTRE_V-12.patch
0e9d10415686044244b8e592d67c6a2f466d4307
[pve-kernel.git] / patches / kernel / 0252-x86-cpufeatures-Add-X86_BUG_SPECTRE_V-12.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: David Woodhouse <dwmw@amazon.co.uk>
3 Date: Sat, 6 Jan 2018 11:49:23 +0000
4 Subject: [PATCH] x86/cpufeatures: Add X86_BUG_SPECTRE_V[12]
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 CVE-2017-5754
10
11 Add the bug bits for spectre v1/2 and force them unconditionally for all
12 cpus.
13
14 Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
15 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 Cc: gnomes@lxorguk.ukuu.org.uk
17 Cc: Rik van Riel <riel@redhat.com>
18 Cc: Andi Kleen <ak@linux.intel.com>
19 Cc: Peter Zijlstra <peterz@infradead.org>
20 Cc: Linus Torvalds <torvalds@linux-foundation.org>
21 Cc: Jiri Kosina <jikos@kernel.org>
22 Cc: Andy Lutomirski <luto@amacapital.net>
23 Cc: Dave Hansen <dave.hansen@intel.com>
24 Cc: Kees Cook <keescook@google.com>
25 Cc: Tim Chen <tim.c.chen@linux.intel.com>
26 Cc: Greg Kroah-Hartman <gregkh@linux-foundation.org>
27 Cc: Paul Turner <pjt@google.com>
28 Cc: stable@vger.kernel.org
29 Link: https://lkml.kernel.org/r/1515239374-23361-2-git-send-email-dwmw@amazon.co.uk
30 (cherry picked from commit 99c6fa2511d8a683e61468be91b83f85452115fa)
31 Signed-off-by: Andy Whitcroft <apw@canonical.com>
32 Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
33 (cherry picked from commit de861dbf4587b9dac9a1978e6349199755e8c1b1)
34 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
35 ---
36 arch/x86/include/asm/cpufeatures.h | 2 ++
37 arch/x86/kernel/cpu/common.c | 3 +++
38 2 files changed, 5 insertions(+)
39
40 diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
41 index b7900d26066c..3928050b51b0 100644
42 --- a/arch/x86/include/asm/cpufeatures.h
43 +++ b/arch/x86/include/asm/cpufeatures.h
44 @@ -341,5 +341,7 @@
45 #define X86_BUG_MONITOR X86_BUG(12) /* IPI required to wake up remote CPU */
46 #define X86_BUG_AMD_E400 X86_BUG(13) /* CPU is among the affected by Erratum 400 */
47 #define X86_BUG_CPU_MELTDOWN X86_BUG(14) /* CPU is affected by meltdown attack and needs kernel page table isolation */
48 +#define X86_BUG_SPECTRE_V1 X86_BUG(15) /* CPU is affected by Spectre variant 1 attack with conditional branches */
49 +#define X86_BUG_SPECTRE_V2 X86_BUG(16) /* CPU is affected by Spectre variant 2 attack with indirect branches */
50
51 #endif /* _ASM_X86_CPUFEATURES_H */
52 diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
53 index 142ab555dafa..01abbf69d522 100644
54 --- a/arch/x86/kernel/cpu/common.c
55 +++ b/arch/x86/kernel/cpu/common.c
56 @@ -902,6 +902,9 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
57 if (c->x86_vendor != X86_VENDOR_AMD)
58 setup_force_cpu_bug(X86_BUG_CPU_MELTDOWN);
59
60 + setup_force_cpu_bug(X86_BUG_SPECTRE_V1);
61 + setup_force_cpu_bug(X86_BUG_SPECTRE_V2);
62 +
63 fpu__init_system(c);
64 }
65
66 --
67 2.14.2
68