• Dan Williams's avatar
    mm: fix device-dax pud write-faults triggered by get_user_pages() · 1501899a
    Dan Williams authored
    Currently only get_user_pages_fast() can safely handle the writable gup
    case due to its use of pud_access_permitted() to check whether the pud
    entry is writable.  In the gup slow path pud_write() is used instead of
    pud_access_permitted() and to date it has been unimplemented, just calls
        kernel BUG at ./include/linux/hugetlb.h:244!
        RIP: 0010:follow_devmap_pud+0x482/0x490
        Call Trace:
         ? nfs_start_io_direct+0x63/0x70
    For now this just implements a simple check for the _PAGE_RW bit similar
    to pmd_write.  However, this implies that the gup-slow-path check is
    missing the extra checks that the gup-fast-path performs with
    pud_access_permitted.  Later patches will align all checks to use the
    'access_permitted' helper if the architecture provides it.
    Note that the generic 'access_permitted' helper fallback is the simple
    _PAGE_RW check on architectures that do not define the
    'access_permitted' helper(s).
    [dan.j.williams@intel.com: fix powerpc compile error]
      Link: http://lkml.kernel.org/r/151129126165.37405.16031785266675461397.stgit@dwillia2-desk3.amr.corp.intel.com
    Link: http://lkml.kernel.org/r/151043109938.2842.14834662818213616199.stgit@dwillia2-desk3.amr.corp.intel.com
    Fixes: a00cc7d9
     ("mm, x86: add support for PUD-sized transparent hugepages")
    Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
    Acked-by: Thomas Gleixner <tglx@linutronix.de>	[x86]
    Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Dave Hansen <dave.hansen@intel.com>
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
hugetlb.h 16.5 KB