lkml.org 
[lkml]   [2017]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 39/60] x86/mm/kpti: Share cpu_entry_area PMDs
From: Andy Lutomirski <luto@kernel.org>

Share the FIX_USR_SHARED PMDs so the user space and kernel space page
tables have the same PMD page.

[ tglx: Made it use the FIX_USR_SHARED range so later additions
are covered automatically ]

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/mm/kpti.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

--- a/arch/x86/mm/kpti.c
+++ b/arch/x86/mm/kpti.c
@@ -167,6 +167,23 @@ kpti_clone_pmds(unsigned long start, uns
}

/*
+ * Clone the populated PMDs of the user shared fixmaps into the user space
+ * visible page table.
+ */
+static void __init kpti_clone_user_shared(void)
+{
+ unsigned long bot, top;
+
+ bot = __fix_to_virt(FIX_USR_SHARED_BOTTOM);
+ top = __fix_to_virt(FIX_USR_SHARED_TOP) + PAGE_SIZE;
+
+ /* Top of the user shared block must be PMD-aligned. */
+ WARN_ON(top & ~PMD_MASK);
+
+ kpti_clone_pmds(bot, top, 0);
+}
+
+/*
* Ensure that the top level of the user page tables are entirely
* populated. This ensures that all processes that get forked have the
* same entries. This way, we do not have to ever go set up new entries in
@@ -216,4 +233,5 @@ void __init kpti_init(void)
pr_info("enabled\n");

kpti_init_all_pgds();
+ kpti_clone_user_shared();
}

\
 
 \ /
  Last update: 2017-12-04 17:53    [W:0.344 / U:0.440 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site