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 41/60] x86/mm/kpti: Share entry text PMD
From: Thomas Gleixner <tglx@linutronix.de>

Share the entry text PMD of the kernel mapping with the user space
mapping. If large pages are enabled this is a single PMD entry and at the
point where it is copied into the user page table the RW bit has not been
cleared yet. Clear it right away so the user space visible map becomes RX.

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

--- a/arch/x86/mm/kpti.c
+++ b/arch/x86/mm/kpti.c
@@ -184,6 +184,15 @@ static void __init kpti_clone_user_share
}

/*
+ * Clone the populated PMDs of the entry and irqentry text and force it RO.
+ */
+static void __init kpti_clone_entry_text(void)
+{
+ kpti_clone_pmds((unsigned long) __entry_text_start,
+ (unsigned long) __irqentry_text_end, _PAGE_RW);
+}
+
+/*
* 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
@@ -234,4 +243,5 @@ void __init kpti_init(void)

kpti_init_all_pgds();
kpti_clone_user_shared();
+ kpti_clone_entry_text();
}

\
 
 \ /
  Last update: 2017-12-04 18:02    [W:0.369 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site