linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Dan Williams <dan.j.williams@intel.com>
Cc: akpm@linux-foundation.org, Arnd Bergmann <arnd@arndb.de>,
	linux-mm@kvack.org, Catalin Marinas <catalin.marinas@arm.com>,
	x86@kernel.org, Will Deacon <will.deacon@arm.com>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Dave Hansen <dave.hansen@intel.com>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	linux-nvdimm@lists.01.org
Subject: Re: [PATCH v2 1/4] mm: fix device-dax pud write-faults triggered by get_user_pages()
Date: Thu, 23 Nov 2017 19:23:31 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1711231922500.2364@nanos> (raw)
In-Reply-To: <151043109938.2842.14834662818213616199.stgit@dwillia2-desk3.amr.corp.intel.com>



On Sat, 11 Nov 2017, Dan Williams wrote:

> 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
> BUG_ON().
> 
>     kernel BUG at ./include/linux/hugetlb.h:244!
>     [..]
>     RIP: 0010:follow_devmap_pud+0x482/0x490
>     [..]
>     Call Trace:
>      follow_page_mask+0x28c/0x6e0
>      __get_user_pages+0xe4/0x6c0
>      get_user_pages_unlocked+0x130/0x1b0
>      get_user_pages_fast+0x89/0xb0
>      iov_iter_get_pages_alloc+0x114/0x4a0
>      nfs_direct_read_schedule_iovec+0xd2/0x350
>      ? nfs_start_io_direct+0x63/0x70
>      nfs_file_direct_read+0x1e0/0x250
>      nfs_file_read+0x90/0xc0
> 
> 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).
> 
> Fixes: a00cc7d9dd93 ("mm, x86: add support for PUD-sized transparent hugepages")
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> 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>
> Cc: <x86@kernel.org>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  arch/arm64/include/asm/pgtable.h    |    1 +
>  arch/sparc/include/asm/pgtable_64.h |    1 +
>  arch/x86/include/asm/pgtable.h      |    6 ++++++

For the x86 part:

Acked-by: Thomas Gleixner <tglx@linutronix.de>

  reply	other threads:[~2017-11-23 18:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-11 20:11 [PATCH v2 0/4] fix device-dax pud crash and fixup {pte, pmd, pud}_write Dan Williams
2017-11-11 20:11 ` [PATCH v2 1/4] mm: fix device-dax pud write-faults triggered by get_user_pages() Dan Williams
2017-11-23 18:23   ` Thomas Gleixner [this message]
2017-11-11 20:11 ` [PATCH v2 2/4] mm: replace pud_write with pud_access_permitted in fault + gup paths Dan Williams
2017-11-11 20:11 ` [PATCH v2 3/4] mm: replace pmd_write with pmd_access_permitted " Dan Williams
2017-11-11 20:11 ` [PATCH v2 4/4] mm: replace pte_write with pte_access_permitted " Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1711231922500.2364@nanos \
    --to=tglx@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=davem@davemloft.net \
    --cc=hpa@zytor.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=mingo@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=will.deacon@arm.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).