Skip to content

Commit 6dc72c3

Browse files
KAGA-KOKOIngo Molnar
authored andcommitted
x86/mm/pti: Share entry text PMD
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]>
1 parent 2f7412b commit 6dc72c3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

arch/x86/mm/pti.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,15 @@ static void __init pti_clone_user_shared(void)
287287
pti_clone_p4d(CPU_ENTRY_AREA_BASE);
288288
}
289289

290+
/*
291+
* Clone the populated PMDs of the entry and irqentry text and force it RO.
292+
*/
293+
static void __init pti_clone_entry_text(void)
294+
{
295+
pti_clone_pmds((unsigned long) __entry_text_start,
296+
(unsigned long) __irqentry_text_end, _PAGE_RW);
297+
}
298+
290299
/*
291300
* Initialize kernel page table isolation
292301
*/
@@ -298,4 +307,5 @@ void __init pti_init(void)
298307
pr_info("enabled\n");
299308

300309
pti_clone_user_shared();
310+
pti_clone_entry_text();
301311
}

0 commit comments

Comments
 (0)