| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- From 9b8667a59df870d8f965d6681cb18843302c8510 Mon Sep 17 00:00:00 2001
- From: Thomas Gleixner <[email protected]>
- Date: Mon, 4 Dec 2017 15:07:47 +0100
- Subject: [PATCH 200/242] x86/mm/pti: Share entry text PMD
- MIME-Version: 1.0
- Content-Type: text/plain; charset=UTF-8
- Content-Transfer-Encoding: 8bit
- CVE-2017-5754
- 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 <[email protected]>
- Cc: Andy Lutomirski <[email protected]>
- Cc: Boris Ostrovsky <[email protected]>
- Cc: Borislav Petkov <[email protected]>
- Cc: Brian Gerst <[email protected]>
- Cc: Dave Hansen <[email protected]>
- Cc: David Laight <[email protected]>
- Cc: Denys Vlasenko <[email protected]>
- Cc: Eduardo Valentin <[email protected]>
- Cc: Greg KH <[email protected]>
- Cc: H. Peter Anvin <[email protected]>
- Cc: Josh Poimboeuf <[email protected]>
- Cc: Juergen Gross <[email protected]>
- Cc: Linus Torvalds <[email protected]>
- Cc: Peter Zijlstra <[email protected]>
- Cc: Will Deacon <[email protected]>
- Cc: [email protected]
- Cc: [email protected]
- Cc: [email protected]
- Cc: [email protected]
- Signed-off-by: Ingo Molnar <[email protected]>
- (cherry picked from commit 6dc72c3cbca0580642808d677181cad4c6433893)
- Signed-off-by: Andy Whitcroft <[email protected]>
- Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
- (cherry picked from commit ee98d7446b4a7c12a57a38b1a5f51e3df0ac2cf3)
- Signed-off-by: Fabian Grünbichler <[email protected]>
- ---
- arch/x86/mm/pti.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
- diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
- index 59290356f19f..0e78797650a7 100644
- --- a/arch/x86/mm/pti.c
- +++ b/arch/x86/mm/pti.c
- @@ -287,6 +287,15 @@ static void __init pti_clone_user_shared(void)
- pti_clone_p4d(CPU_ENTRY_AREA_BASE);
- }
-
- +/*
- + * Clone the populated PMDs of the entry and irqentry text and force it RO.
- + */
- +static void __init pti_clone_entry_text(void)
- +{
- + pti_clone_pmds((unsigned long) __entry_text_start,
- + (unsigned long) __irqentry_text_end, _PAGE_RW);
- +}
- +
- /*
- * Initialize kernel page table isolation
- */
- @@ -298,4 +307,5 @@ void __init pti_init(void)
- pr_info("enabled\n");
-
- pti_clone_user_shared();
- + pti_clone_entry_text();
- }
- --
- 2.14.2
|