lkml.org 
[lkml]   [2017]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch V149 30/50] x86/mm/pti: Share cpu_entry_area PMDs
    From: Andy Lutomirski <luto@kernel.org>

    Share the FIX_USR_SHARED PMDs so the user space and kernel space page
    tables have the same PMD page.

    [ tglx: Made it use the FIX_USR_SHARED range so later additions
    are covered automatically ]

    Signed-off-by: Andy Lutomirski <luto@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.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: H. Peter Anvin <hpa@zytor.com>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Juergen Gross <jgross@suse.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.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
    ---
    arch/x86/mm/pti.c | 19 +++++++++++++++++++
    1 file changed, 19 insertions(+)

    --- a/arch/x86/mm/pti.c
    +++ b/arch/x86/mm/pti.c
    @@ -187,6 +187,23 @@ pti_clone_pmds(unsigned long start, unsi
    }

    /*
    + * Clone the populated PMDs of the user shared fixmaps into the user space
    + * visible page table.
    + */
    +static void __init pti_clone_user_shared(void)
    +{
    + unsigned long bot, top;
    +
    + bot = __fix_to_virt(FIX_USR_SHARED_BOTTOM);
    + top = __fix_to_virt(FIX_USR_SHARED_TOP) + PAGE_SIZE;
    +
    + /* Top of the user shared block must be PMD-aligned. */
    + WARN_ON(top & ~PMD_MASK);
    +
    + pti_clone_pmds(bot, top, 0);
    +}
    +
    +/*
    * Initialize kernel page table isolation
    */
    void __init pti_init(void)
    @@ -195,4 +212,6 @@ void __init pti_init(void)
    return;

    pr_info("enabled\n");
    +
    + pti_clone_user_shared();
    }

    \
     
     \ /
      Last update: 2017-12-16 22:43    [W:4.611 / U:0.404 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site