]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0215-x86-mm-dump_pagetables-Add-page-table-directory-to-t.patch
KPTI: add follow-up fixes
[pve-kernel.git] / patches / kernel / 0215-x86-mm-dump_pagetables-Add-page-table-directory-to-t.patch
CommitLineData
321d628a
FG
1From d03b4d2a3e43228bb98fae4c6f5365d4f9d00f4c Mon Sep 17 00:00:00 2001
2From: Borislav Petkov <bp@suse.de>
3Date: Mon, 4 Dec 2017 15:08:04 +0100
e4cdf2a5 4Subject: [PATCH 215/241] x86/mm/dump_pagetables: Add page table directory to
321d628a
FG
5 the debugfs VFS hierarchy
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10CVE-2017-5754
11
12The upcoming support for dumping the kernel and the user space page tables
13of the current process would create more random files in the top level
14debugfs directory.
15
16Add a page table directory and move the existing file to it.
17
18Signed-off-by: Borislav Petkov <bp@suse.de>
19Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
20Cc: Andy Lutomirski <luto@kernel.org>
21Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
22Cc: Borislav Petkov <bp@alien8.de>
23Cc: Brian Gerst <brgerst@gmail.com>
24Cc: Dave Hansen <dave.hansen@linux.intel.com>
25Cc: David Laight <David.Laight@aculab.com>
26Cc: Denys Vlasenko <dvlasenk@redhat.com>
27Cc: Eduardo Valentin <eduval@amazon.com>
28Cc: Greg KH <gregkh@linuxfoundation.org>
29Cc: H. Peter Anvin <hpa@zytor.com>
30Cc: Josh Poimboeuf <jpoimboe@redhat.com>
31Cc: Juergen Gross <jgross@suse.com>
32Cc: Linus Torvalds <torvalds@linux-foundation.org>
33Cc: Peter Zijlstra <peterz@infradead.org>
34Cc: Will Deacon <will.deacon@arm.com>
35Cc: aliguori@amazon.com
36Cc: daniel.gruss@iaik.tugraz.at
37Cc: hughd@google.com
38Cc: keescook@google.com
39Signed-off-by: Ingo Molnar <mingo@kernel.org>
40(cherry picked from commit 75298aa179d56cd64f54e58a19fffc8ab922b4c0)
41Signed-off-by: Andy Whitcroft <apw@canonical.com>
42Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
43(cherry picked from commit ae5c4af9bbefed4adc12075c28fb5889547c99cc)
44Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
45---
46 arch/x86/mm/debug_pagetables.c | 15 ++++++++++-----
47 1 file changed, 10 insertions(+), 5 deletions(-)
48
49diff --git a/arch/x86/mm/debug_pagetables.c b/arch/x86/mm/debug_pagetables.c
50index bfcffdf6c577..d1449fb6dc7a 100644
51--- a/arch/x86/mm/debug_pagetables.c
52+++ b/arch/x86/mm/debug_pagetables.c
53@@ -22,21 +22,26 @@ static const struct file_operations ptdump_fops = {
54 .release = single_release,
55 };
56
57-static struct dentry *pe;
58+static struct dentry *dir, *pe;
59
60 static int __init pt_dump_debug_init(void)
61 {
62- pe = debugfs_create_file("kernel_page_tables", S_IRUSR, NULL, NULL,
63- &ptdump_fops);
64- if (!pe)
65+ dir = debugfs_create_dir("page_tables", NULL);
66+ if (!dir)
67 return -ENOMEM;
68
69+ pe = debugfs_create_file("kernel", 0400, dir, NULL, &ptdump_fops);
70+ if (!pe)
71+ goto err;
72 return 0;
73+err:
74+ debugfs_remove_recursive(dir);
75+ return -ENOMEM;
76 }
77
78 static void __exit pt_dump_debug_exit(void)
79 {
80- debugfs_remove_recursive(pe);
81+ debugfs_remove_recursive(dir);
82 }
83
84 module_init(pt_dump_debug_init);
85--
862.14.2
87