• Jan Beulich's avatar
    x86/mm: Consider effective protection attributes in W+X check · 672c0ae0
    Jan Beulich authored
    Using just the leaf page table entry flags would cause a false warning
    in case _PAGE_RW is clear or _PAGE_NX is set in a higher level entry.
    Hand through both the current entry's flags as well as the accumulated
    effective value (the latter as pgprotval_t instead of pgprot_t, as it's
    not an actual entry's value).
    
    This in particular eliminates the false W+X warning when running under
    Xen, as commit:
    
      2cc42bac ("x86-64/Xen: eliminate W+X mappings")
    
    had to make the necessary adjustment in L2 rather than L1 (the reason is
    explained there). I.e. _PAGE_RW is clear there in L1, but _PAGE_NX is
    set in L2.
    Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
    Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/5A8FDE8902000078001AABBB@prv-mh.provo.novell.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    672c0ae0
dump_pagetables.c 16.3 KB