]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0213-x86-dumpstack-Indicate-in-Oops-whether-PTI-is-config.patch
977867a98e79658620445b0dfa9fc343e148d474
[pve-kernel.git] / patches / kernel / 0213-x86-dumpstack-Indicate-in-Oops-whether-PTI-is-config.patch
1 From c7ef01f56951b1c876069387c44e11575288f3d2 Mon Sep 17 00:00:00 2001
2 From: Vlastimil Babka <vbabka@suse.cz>
3 Date: Tue, 19 Dec 2017 22:33:46 +0100
4 Subject: [PATCH 213/233] x86/dumpstack: Indicate in Oops whether PTI is
5 configured and enabled
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 CVE-2017-5754
11
12 CONFIG_PAGE_TABLE_ISOLATION is relatively new and intrusive feature that may
13 still have some corner cases which could take some time to manifest and be
14 fixed. It would be useful to have Oops messages indicate whether it was
15 enabled for building the kernel, and whether it was disabled during boot.
16
17 Example of fully enabled:
18
19 Oops: 0001 [#1] SMP PTI
20
21 Example of enabled during build, but disabled during boot:
22
23 Oops: 0001 [#1] SMP NOPTI
24
25 We can decide to remove this after the feature has been tested in the field
26 long enough.
27
28 [ tglx: Made it use boot_cpu_has() as requested by Borislav ]
29
30 Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
31 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
32 Reviewed-by: Eduardo Valentin <eduval@amazon.com>
33 Acked-by: Dave Hansen <dave.hansen@intel.com>
34 Cc: Andy Lutomirski <luto@kernel.org>
35 Cc: Andy Lutomirsky <luto@kernel.org>
36 Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
37 Cc: Borislav Petkov <bp@alien8.de>
38 Cc: Brian Gerst <brgerst@gmail.com>
39 Cc: Dave Hansen <dave.hansen@linux.intel.com>
40 Cc: David Laight <David.Laight@aculab.com>
41 Cc: Denys Vlasenko <dvlasenk@redhat.com>
42 Cc: Greg KH <gregkh@linuxfoundation.org>
43 Cc: H. Peter Anvin <hpa@zytor.com>
44 Cc: Josh Poimboeuf <jpoimboe@redhat.com>
45 Cc: Juergen Gross <jgross@suse.com>
46 Cc: Linus Torvalds <torvalds@linux-foundation.org>
47 Cc: Peter Zijlstra <peterz@infradead.org>
48 Cc: Will Deacon <will.deacon@arm.com>
49 Cc: aliguori@amazon.com
50 Cc: bpetkov@suse.de
51 Cc: daniel.gruss@iaik.tugraz.at
52 Cc: hughd@google.com
53 Cc: jkosina@suse.cz
54 Cc: keescook@google.com
55 Signed-off-by: Ingo Molnar <mingo@kernel.org>
56 (cherry picked from commit 5f26d76c3fd67c48806415ef8b1116c97beff8ba)
57 Signed-off-by: Andy Whitcroft <apw@canonical.com>
58 Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
59 (cherry picked from commit 7edb91fcc96589ad6b80446ec3835f83ffabb710)
60 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
61 ---
62 arch/x86/kernel/dumpstack.c | 6 ++++--
63 1 file changed, 4 insertions(+), 2 deletions(-)
64
65 diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
66 index 2bdeb983b9d8..19a936e9b259 100644
67 --- a/arch/x86/kernel/dumpstack.c
68 +++ b/arch/x86/kernel/dumpstack.c
69 @@ -298,11 +298,13 @@ int __die(const char *str, struct pt_regs *regs, long err)
70 unsigned long sp;
71 #endif
72 printk(KERN_DEFAULT
73 - "%s: %04lx [#%d]%s%s%s%s\n", str, err & 0xffff, ++die_counter,
74 + "%s: %04lx [#%d]%s%s%s%s%s\n", str, err & 0xffff, ++die_counter,
75 IS_ENABLED(CONFIG_PREEMPT) ? " PREEMPT" : "",
76 IS_ENABLED(CONFIG_SMP) ? " SMP" : "",
77 debug_pagealloc_enabled() ? " DEBUG_PAGEALLOC" : "",
78 - IS_ENABLED(CONFIG_KASAN) ? " KASAN" : "");
79 + IS_ENABLED(CONFIG_KASAN) ? " KASAN" : "",
80 + IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION) ?
81 + (boot_cpu_has(X86_FEATURE_PTI) ? " PTI" : " NOPTI") : "");
82
83 if (notify_die(DIE_OOPS, str, regs, err,
84 current->thread.trap_nr, SIGSEGV) == NOTIFY_STOP)
85 --
86 2.14.2
87