[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-ba0364e260ab37c02975557dbecc014a26072236@git.kernel.org>
Date: Thu, 19 Jul 2018 16:34:18 -0700
From: tip-bot for Joerg Roedel <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: David.Laight@...lab.com, mingo@...nel.org, hpa@...or.com,
dhgutteridge@...patico.ca, pavel@....cz, dvlasenk@...hat.com,
brgerst@...il.com, peterz@...radead.org, tglx@...utronix.de,
jkosina@...e.cz, bp@...en8.de, luto@...nel.org,
jpoimboe@...hat.com, gregkh@...uxfoundation.org,
aarcange@...hat.com, will.deacon@....com,
torvalds@...ux-foundation.org, dave.hansen@...el.com,
linux-kernel@...r.kernel.org, boris.ostrovsky@...cle.com,
jroedel@...e.de, llong@...hat.com, eduval@...zon.com,
jgross@...e.com
Subject: [tip:x86/pti] x86/mm/pti: Clone entry-text again in pti_finalize()
Commit-ID: ba0364e260ab37c02975557dbecc014a26072236
Gitweb: https://git.kernel.org/tip/ba0364e260ab37c02975557dbecc014a26072236
Author: Joerg Roedel <jroedel@...e.de>
AuthorDate: Wed, 18 Jul 2018 11:41:07 +0200
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Fri, 20 Jul 2018 01:11:45 +0200
x86/mm/pti: Clone entry-text again in pti_finalize()
The mapping for entry-text might have changed in the kernel after it was
cloned to the user page-table. Clone again to update the user page-table to
bring the mapping in sync with the kernel again.
Signed-off-by: Joerg Roedel <jroedel@...e.de>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Tested-by: Pavel Machek <pavel@....cz>
Cc: "H . Peter Anvin" <hpa@...or.com>
Cc: linux-mm@...ck.org
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Dave Hansen <dave.hansen@...el.com>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Juergen Gross <jgross@...e.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Jiri Kosina <jkosina@...e.cz>
Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>
Cc: Brian Gerst <brgerst@...il.com>
Cc: David Laight <David.Laight@...lab.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: Eduardo Valentin <eduval@...zon.com>
Cc: Greg KH <gregkh@...uxfoundation.org>
Cc: Will Deacon <will.deacon@....com>
Cc: aliguori@...zon.com
Cc: daniel.gruss@...k.tugraz.at
Cc: hughd@...gle.com
Cc: keescook@...gle.com
Cc: Andrea Arcangeli <aarcange@...hat.com>
Cc: Waiman Long <llong@...hat.com>
Cc: "David H . Gutteridge" <dhgutteridge@...patico.ca>
Cc: joro@...tes.org
Link: https://lkml.kernel.org/r/1531906876-13451-31-git-send-email-joro@8bytes.org
---
arch/x86/mm/pti.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
index fcfb815d420f..a536ecc91847 100644
--- a/arch/x86/mm/pti.c
+++ b/arch/x86/mm/pti.c
@@ -404,7 +404,7 @@ static void __init pti_setup_espfix64(void)
/*
* Clone the populated PMDs of the entry and irqentry text and force it RO.
*/
-static void __init pti_clone_entry_text(void)
+static void pti_clone_entry_text(void)
{
pti_clone_pmds((unsigned long) __entry_text_start,
(unsigned long) __irqentry_text_end,
@@ -528,13 +528,18 @@ void __init pti_init(void)
}
/*
- * Finalize the kernel mappings in the userspace page-table.
+ * Finalize the kernel mappings in the userspace page-table. Some of the
+ * mappings for the kernel image might have changed since pti_init()
+ * cloned them. This is because parts of the kernel image have been
+ * mapped RO and/or NX. These changes need to be cloned again to the
+ * userspace page-table.
*/
void pti_finalize(void)
{
/*
- * Do this after all of the manipulation of the
- * kernel text page tables are complete.
+ * We need to clone everything (again) that maps parts of the
+ * kernel image.
*/
+ pti_clone_entry_text();
pti_clone_kernel_text();
}
Powered by blists - more mailing lists