]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0164-x86-mm-dump_pagetables-Check-PAGE_PRESENT-for-real.patch
KPTI: add follow-up fixes
[pve-kernel.git] / patches / kernel / 0164-x86-mm-dump_pagetables-Check-PAGE_PRESENT-for-real.patch
CommitLineData
321d628a
FG
1From d54a0500d55a2856efdea3b427e91d8fcf74ca63 Mon Sep 17 00:00:00 2001
2From: Thomas Gleixner <tglx@linutronix.de>
3Date: Sat, 16 Dec 2017 01:14:39 +0100
e4cdf2a5 4Subject: [PATCH 164/241] x86/mm/dump_pagetables: Check PAGE_PRESENT for real
321d628a
FG
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9CVE-2017-5754
10
11The check for a present page in printk_prot():
12
13 if (!pgprot_val(prot)) {
14 /* Not present */
15
16is bogus. If a PTE is set to PAGE_NONE then the pgprot_val is not zero and
17the entry is decoded in bogus ways, e.g. as RX GLB. That is confusing when
18analyzing mapping correctness. Check for the present bit to make an
19informed decision.
20
21Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
22Cc: Andy Lutomirski <luto@kernel.org>
23Cc: Borislav Petkov <bp@alien8.de>
24Cc: Dave Hansen <dave.hansen@linux.intel.com>
25Cc: H. Peter Anvin <hpa@zytor.com>
26Cc: Josh Poimboeuf <jpoimboe@redhat.com>
27Cc: Juergen Gross <jgross@suse.com>
28Cc: Linus Torvalds <torvalds@linux-foundation.org>
29Cc: Peter Zijlstra <peterz@infradead.org>
30Cc: linux-kernel@vger.kernel.org
31Signed-off-by: Ingo Molnar <mingo@kernel.org>
32(cherry picked from commit c05344947b37f7cda726e802457370bc6eac4d26)
33Signed-off-by: Andy Whitcroft <apw@canonical.com>
34Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
35(cherry picked from commit d902780eaea12f23b50be4ff00f8df6157c30e4a)
36Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
37---
38 arch/x86/mm/dump_pagetables.c | 2 +-
39 1 file changed, 1 insertion(+), 1 deletion(-)
40
41diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
42index 0470826d2bdc..91aa41c5e0dd 100644
43--- a/arch/x86/mm/dump_pagetables.c
44+++ b/arch/x86/mm/dump_pagetables.c
45@@ -140,7 +140,7 @@ static void printk_prot(struct seq_file *m, pgprot_t prot, int level, bool dmsg)
46 static const char * const level_name[] =
47 { "cr3", "pgd", "pud", "pmd", "pte" };
48
49- if (!pgprot_val(prot)) {
50+ if (!(pr & _PAGE_PRESENT)) {
51 /* Not present */
52 pt_dump_cont_printf(m, dmsg, " ");
53 } else {
54--
552.14.2
56