lkml.org 
[lkml]   [2018]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 10/16] x86/mm/pti: Populate valid user pud entries
Date
From: Joerg Roedel <jroedel@suse.de>

With PAE paging we don't have PGD and P4D levels in the
page-table, instead the PUD level is the highest one.

In PAE page-tables at the top-level most bits we usually set
with _KERNPG_TABLE are reserved, resulting in a #GP when
they are loaded by the processor.

Work around this by populating PUD entries in the user
page-table only with _PAGE_PRESENT set.

I am pretty sure there is a cleaner way to do this, but
until I find it use this #ifdef solution.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
arch/x86/mm/pti.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
index 20be21301a59..6b6bfd13350e 100644
--- a/arch/x86/mm/pti.c
+++ b/arch/x86/mm/pti.c
@@ -202,8 +202,12 @@ static __init pmd_t *pti_user_pagetable_walk_pmd(unsigned long address)
unsigned long new_pmd_page = __get_free_page(gfp);
if (!new_pmd_page)
return NULL;
-
+#ifdef CONFIG_X86_PAE
+ /* TODO: There must be a cleaner way to do this */
+ set_pud(pud, __pud(_PAGE_PRESENT | __pa(new_pmd_page)));
+#else
set_pud(pud, __pud(_KERNPG_TABLE | __pa(new_pmd_page)));
+#endif
}

return pmd_offset(pud, address);
--
2.13.6
\
 
 \ /
  Last update: 2018-01-16 17:56    [W:0.735 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site