diff options
author | Joerg Roedel <jroedel@suse.de> | 2018-08-07 12:24:30 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2018-08-07 23:36:02 +0200 |
commit | 30514effc9206d4e084ec32239ae221db157d43a (patch) | |
tree | e1a49beac8e70571f95a515ec54eb140ddc2f5f8 /arch/x86 | |
parent | 88c6f8a3977cc35997b47e2f99f080a15559c1eb (diff) |
x86/mm/pti: Don't clear permissions in pti_clone_pmd()
The function sets the global-bit on cloned PMD entries, which only makes
sense when the permissions are identical between the user and the kernel
page-table. Further, only write-permissions are cleared for entry-text and
kernel-text sections, which are not writeable at the end of the boot
process.
The reason why this RW clearing exists is that in the early PTI
implementations the cloned kernel areas were set up during early boot
before the kernel text is set to read only and not touched afterwards.
This is not longer true. The cloned areas are still set up early to get the
entry code working for interrupts and other things, but after the kernel
text has been set RO the clone is repeated which copies the RO PMD/PTEs
over to the user visible clone. That means the initial clearing of the
writable bit can be avoided.
[ tglx: Amended changelog ]
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Dave Hansen <dave.hansen@intel.com>
Cc: "H . Peter Anvin" <hpa@zytor.com>
Cc: linux-mm@kvack.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: David Laight <David.Laight@aculab.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Eduardo Valentin <eduval@amazon.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: aliguori@amazon.com
Cc: daniel.gruss@iaik.tugraz.at
Cc: hughd@google.com
Cc: keescook@google.com
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Waiman Long <llong@redhat.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: "David H . Gutteridge" <dhgutteridge@sympatico.ca>
Cc: joro@8bytes.org
Link: https://lkml.kernel.org/r/1533637471-30953-3-git-send-email-joro@8bytes.org
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/mm/pti.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index 113ba14a03d8..5164c987b1f1 100644 --- a/arch/x86/mm/pti.c +++ b/arch/x86/mm/pti.c @@ -291,7 +291,7 @@ static void __init pti_setup_vsyscall(void) { } #endif static void -pti_clone_pmds(unsigned long start, unsigned long end, pmdval_t clear) +pti_clone_pmds(unsigned long start, unsigned long end) { unsigned long addr; @@ -352,7 +352,7 @@ pti_clone_pmds(unsigned long start, unsigned long end, pmdval_t clear) * tables will share the last-level page tables of this * address range */ - *target_pmd = pmd_clear_flags(*pmd, clear); + *target_pmd = *pmd; } } @@ -398,7 +398,7 @@ static void __init pti_clone_user_shared(void) start = CPU_ENTRY_AREA_BASE; end = start + (PAGE_SIZE * CPU_ENTRY_AREA_PAGES); - pti_clone_pmds(start, end, 0); + pti_clone_pmds(start, end); } #endif /* CONFIG_X86_64 */ @@ -418,8 +418,7 @@ static void __init pti_setup_espfix64(void) static void pti_clone_entry_text(void) { pti_clone_pmds((unsigned long) __entry_text_start, - (unsigned long) __irqentry_text_end, - _PAGE_RW); + (unsigned long) __irqentry_text_end); } /* @@ -501,7 +500,7 @@ static void pti_clone_kernel_text(void) * pti_set_kernel_image_nonglobal() did to clear the * global bit. */ - pti_clone_pmds(start, end_clone, _PAGE_RW); + pti_clone_pmds(start, end_clone); /* * pti_clone_pmds() will set the global bit in any PMDs |