linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: mawupeng <mawupeng1@huawei.com>
Cc: david@redhat.com, akpm@linux-foundation.org,
	khlebnikov@openvz.org, jaredeh@gmail.com, linmiaohe@huawei.com,
	hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org,
	tglx@linutronix.de, peterz@infradead.org,
	linux-kernel@vger.kernel.org, x86@kernel.org, mingo@redhat.com,
	rdunlap@infradead.org, bhelgaas@google.com, linux-mm@kvack.org
Subject: Re: [Question] CoW on VM_PFNMAP vma during write fault
Date: Wed, 28 Feb 2024 02:10:45 +0000	[thread overview]
Message-ID: <Zd6WJe9xrRwkphfm@casper.infradead.org> (raw)
In-Reply-To: <fa8f9f3b-e01e-4662-a2d5-77caeeb7b9f5@huawei.com>

On Wed, Feb 28, 2024 at 09:55:24AM +0800, mawupeng wrote:
> On 2024/2/27 21:15, David Hildenbrand wrote:
> > On 27.02.24 14:00, David Hildenbrand wrote:
> >> On 27.02.24 13:28, Wupeng Ma wrote:
> >>> We find that a warn will be produced during our test, the detail log is
> >>> shown in the end.
> >>>
> >>> The core problem of this warn is that the first pfn of this pfnmap vma is
> >>> cleared during memory-failure. Digging into the source we find that this
> >>> problem can be triggered as following:
> >>>
> >>> // mmap with MAP_PRIVATE and specific fd which hook mmap
> >>> mmap(MAP_PRIVATE, fd)
> >>>     __mmap_region
> >>>       remap_pfn_range
> >>>       // set vma with pfnmap and the prot of pte is read only
> >>>     
> >>
> >> Okay, so we get a MAP_PRIVATE VM_PFNMAP I assume.
> >>
> >> What fd is that exactly? Often, we disallow private mappings in the
> >> mmap() callback (for a good reason).
> 
> just a device fd with device-specify mmap which use remap_pfn_range to assign memory.

But what meaning do you want MAP_PRIVATE of this fd to have?  Does it
make sense to permit this, or should you rather just return -EINVAL if
somebody tries to mmap() with MAP_PRIVATE set?



  reply	other threads:[~2024-02-28  2:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 12:28 Wupeng Ma
2024-02-27 13:00 ` David Hildenbrand
2024-02-27 13:15   ` David Hildenbrand
2024-02-28  1:55     ` mawupeng
2024-02-28  2:10       ` Matthew Wilcox [this message]
2024-02-28  2:18         ` mawupeng
2024-03-04  8:47       ` mawupeng
2024-03-04  8:57         ` David Hildenbrand
2024-03-04  9:04           ` mawupeng
2024-03-04  9:17             ` 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=Zd6WJe9xrRwkphfm@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=bhelgaas@google.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jaredeh@gmail.com \
    --cc=khlebnikov@openvz.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mawupeng1@huawei.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=tglx@linutronix.de \
    --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