• Joerg Roedel's avatar
    x86/mm/pti: Don't clear permissions in pti_clone_pmd() · 30514eff
    Joerg Roedel authored
    
    
    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: default avatarJoerg Roedel <jroedel@suse.de>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Acked-by: default avatarDave 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
    30514eff
pti.c 16.1 KB