linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Lorenzo Stoakes <lstoakes@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Jens Axboe <axboe@kernel.dk>,
	Matthew Wilcox <willy@infradead.org>,
	Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>,
	Leon Romanovsky <leon@kernel.org>,
	Christian Benvenuti <benve@cisco.com>,
	Nelson Escobar <neescoba@cisco.com>,
	Bernard Metzler <bmt@zurich.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Bjorn Topel <bjorn@kernel.org>,
	Magnus Karlsson <magnus.karlsson@intel.com>,
	Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
	Jonathan Lemon <jonathan.lemon@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Christian Brauner <brauner@kernel.org>,
	Richard Cochran <richardcochran@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	linux-fsdevel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH] mm/gup: disallow GUP writing to file-backed mappings by default
Date: Mon, 24 Apr 2023 14:59:59 -0300	[thread overview]
Message-ID: <ZEbDn8fVRvm5XeEl@ziepe.ca> (raw)
In-Reply-To: <20230424134026.di6nf2an3a2g63a6@box.shutemov.name>

On Mon, Apr 24, 2023 at 04:40:26PM +0300, Kirill A. Shutemov wrote:
> > Something more general would be preferable, however I believe there were
> > concerns broader than write notify, for instance not correctly marking the
> > folio dirty after writing to it, though arguably the caller should
> > certainly be ensuring that (and in many cases, do).
> 
> It doesn't make much sense to me.
> 
> Shared writable mapping without page_mkwrite (or pfn_write) will setup
> writeable PTE even on read faults[1], so you will not get the page dirty,
> unless you scan page table entries for dirty bit.

The general statement for supporting GUP is that the VMA owner never
relies on write protect, either explicitly through removing the write
bit in the PTE or implicitly through zapping the inode and removing
all PTEs.

The general bug we have is that the FS does some action to prevent
writes and then becomes surprised that the page was made dirty.

GUP allows write access to the page to continue past any write protect
action the FS takes.

AFAIK all GUP users do correctly do mkdirty and we have helpers to
support this during unpin, that is not the bug.

So, I don't know about page_mkwrite, if it correlates with the abvoe
then great :)

Jason


  reply	other threads:[~2023-04-24 18:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-22 13:37 [PATCH] mm/gup: disallow GUP writing to file-backed mappings by default Lorenzo Stoakes
2023-04-23  0:46 ` Hillf Danton
2023-04-23 19:32 ` Simon Horman
2023-04-23 19:40   ` Lorenzo Stoakes
2023-04-23 20:02     ` Simon Horman
2023-04-23 22:29 ` Dave Chinner
2023-04-23 22:56   ` Lorenzo Stoakes
2023-04-24 17:49     ` Jason Gunthorpe
2023-04-24  3:41 ` Mika Penttilä
2023-04-24  6:51   ` Lorenzo Stoakes
2023-04-24 12:02 ` Kirill A. Shutemov
2023-04-24 12:31   ` Lorenzo Stoakes
2023-04-24 13:40     ` Kirill A. Shutemov
2023-04-24 17:59       ` Jason Gunthorpe [this message]
2023-04-24 16:09 ` Jan Kara
2023-04-24 16:22   ` Lorenzo Stoakes
2023-04-24 17:53   ` Jason Gunthorpe

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=ZEbDn8fVRvm5XeEl@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ast@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=benve@cisco.com \
    --cc=bjorn@kernel.org \
    --cc=bmt@zurich.ibm.com \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=irogers@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=jonathan.lemon@gmail.com \
    --cc=kirill@shutemov.name \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=lstoakes@gmail.com \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=neescoba@cisco.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peterz@infradead.org \
    --cc=richardcochran@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).