linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	Mel Gorman <mgorman@suse.de>,
	Matthew Wilcox <willy@infradead.org>,
	"Aneesh Kumar K . V" <aneesh.kumar@linux.vnet.ibm.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] mm/gup: Fix follow_devmap_p[mu]d() on page==NULL handling
Date: Sun, 26 Nov 2023 16:55:19 -0500	[thread overview]
Message-ID: <ZWO-x_ElKe6qtsIq@x1n> (raw)
In-Reply-To: <20231124112059.3519d6fdfe71f846f8bf726f@linux-foundation.org>

On Fri, Nov 24, 2023 at 11:20:59AM -0800, Andrew Morton wrote:
> On Thu, 23 Nov 2023 13:02:22 -0500 Peter Xu <peterx@redhat.com> wrote:
> 
> > This is a bug found not by any report but only by code observations.
> > 
> > When GUP sees a devpmd/devpud and if page==NULL is returned, it means a
> > fault is probably required.  Here falling through when page==NULL can cause
> > unexpected behavior.
> > 
> 
> Well this is worrisome.  We aren't able to construct a test case to
> demonstrate this bug?  Why is that?  Is it perhaps just dead code?

IIUC it's not dead code. Take the example of follow_devmap_pmd(), it can
return page==NULL at least when seeing write bit missing:

	if (flags & FOLL_WRITE && !pmd_write(*pmd))
		return NULL;

AFAICT it can happen if someone does "echo 4 > /proc/$PID/clear_refs" when
the mm contains the devmap pmd.  Same to pud.

It'll be nice if someone that works with dax would like to verify it.  In
my series (refactor hugetlb gup, part 2) IIUC some hugetlb selftest can
start to trigger this path, but I'll need to check.  So far it's dax-only.

Thanks,

-- 
Peter Xu



  reply	other threads:[~2023-11-26 21:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23 18:02 Peter Xu
2023-11-24 19:20 ` Andrew Morton
2023-11-26 21:55   ` Peter Xu [this message]
2023-11-27 16:22     ` David Hildenbrand

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=ZWO-x_ElKe6qtsIq@x1n \
    --to=peterx@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=dan.j.williams@intel.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=willy@infradead.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