• Dave Hansen's avatar
    x86/mm/pkeys: Fill in pkey field in siginfo · 019132ff
    Dave Hansen authored
    This fills in the new siginfo field: si_pkey to indicate to
    userspace which protection key was set on the PTE that we faulted
    on.
    
    Note though that *ALL* protection key faults have to be generated
    by a valid, present PTE at some point.  But this code does no PTE
    lookups which seeds odd.  The reason is that we take advantage of
    the way we generate PTEs from VMAs.  All PTEs under a VMA share
    some attributes.  For instance, they are _all_ either PROT_READ
    *OR* PROT_NONE.  They also always share a protection key, so we
    never have to walk the page tables; we just use the VMA.
    
    Note that _pkey is a 64-bit value.  The current hardware only
    supports 4-bit protection keys.  We do this because there is
    _plenty_ of space in _sigfault and it is possible that future
    processors would support more than 4 bits of protection keys.
    Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
    Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Andy Lutomirski <luto@amacapital.net>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Dave Hansen <dave@sr71.net>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: linux-mm@kvack.org
    Link: http://lkml.kernel.org/r/20160212210213.ABC488FA@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    019132ff
fault.c 35.1 KB