linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>,
	Andrew Morton <akpm@osdl.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Jeff Moyer <jmoyer@redhat.com>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH 0/6] IO pinning(get_user_pages()) vs fork race fix
Date: Tue, 14 Apr 2009 19:37:21 +1000	[thread overview]
Message-ID: <200904141937.23584.nickpiggin@yahoo.com.au> (raw)
In-Reply-To: <20090414175525.C67C.A69D9226@jp.fujitsu.com>

On Tuesday 14 April 2009 19:19:10 KOSAKI Motohiro wrote:

> > I don't see how it fixes vmsplice? vmsplice can get_user_pages pages from one
> > process's address space and put them into a pipe, and they are released by
> > another process after consuming the pages I think. So it's fairly hard to hold
> > a lock over this.
> 
> I recognize my explanation is poor.
> 
> firstly, pipe_to_user() via vmsplice_to_user use copy_to_user. then we don't need care
> receive side.
> secondly, get_iovec_page_array() via vmsplice_to_pipe() use gup(read).
> then we only need prevent to change the page.
> 
> I changed reuse_swap_page() at [1/6]. then if any process touch the page while
> the process isn't recived yet, it makes COW break and toucher get copyed page.
> then, Anybody can't change original page.
> 
> Thus, This patch series also fixes vmsplice issue, I think.
> Am I missing anything?

Ah thanks, I see now. No I don't think you're missing anything.


> > I guess apart from the vmsplice issue (unless I missed a clever fix), I guess
> > this *does* work. I can't see any races... I'd really still like to hear a good
> > reason why my proposed patch is so obviously crap.
> > 
> > Reasons proposed so far:
> > "No locking" (I think this is a good thing; no *bugs* have been pointed out)
> > "Too many page flags" (but it only uses 1 anon page flag, only fs pagecache
> > has a flags shortage so we can easily overload a pagecache flag)
> > "Diffstat too large" (seems comparable when you factor in the fixes to callers,
> > but has the advantage of being contained within VM subsystem)
> > "Horrible code" (I still don't see it. Of course the code will be nicer if we
> > don't fix the issue _at all_, but I don't see this is so much worse than having
> > to fix callers.)
> 
> Honestly, I don't dislike your.
> but I really hope to fix this bug. if someone nak your patch, I'll seek another way.

Yes, I appreciate you looking at alternatives, and you haven't been strongly
arguing against my patch. So this comment was not aimed at you :)


> > FWIW, I have attached my patch again (with simple function-movement hunks
> > moved into another patch so it is easier to see real impact of this patch).
> 
> OK. I try to test your patch too.

Well I split it out and it requires another patch to move functions around
(eg. zap_pte from fremap.c into memory.c). I just attached it here to
illustrate the core of my fix. If you would like to run any real tests, let
me know and I could send a proper rollup.

  reply	other threads:[~2009-04-14  9:37 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090414151204.C647.A69D9226@jp.fujitsu.com>
2009-04-14  6:16 ` [RFC][PATCH v3 1/6] mm: Don't unmap gup()ed page KOSAKI Motohiro
2009-04-14  9:25   ` Nick Piggin
2009-04-14 12:02     ` KOSAKI Motohiro
2009-04-14 12:25       ` Nick Piggin
2009-04-14 13:39         ` KOSAKI Motohiro
2009-04-14 14:12           ` Andrea Arcangeli
2009-04-14 14:26             ` Nick Piggin
2009-04-14 14:32               ` Andrea Arcangeli
2009-04-14 14:42                 ` Nick Piggin
2009-04-14 15:21                   ` Andrea Arcangeli
2009-04-15  8:05                   ` KOSAKI Motohiro
2009-04-15  8:22                     ` Nick Piggin
2009-04-15  9:22                       ` Nick Piggin
2009-04-15 10:46                     ` Andrea Arcangeli
2009-04-15 11:39                       ` KOSAKI Motohiro
2009-04-15 11:41                         ` Andrea Arcangeli
2009-04-15 11:53                           ` KOSAKI Motohiro
2009-04-19 12:37                             ` KOSAKI Motohiro
2009-04-14 14:38   ` Andrea Arcangeli
2009-04-14  6:18 ` [RFC][PATCH v3 2/6] mm, directio: fix fork vs direct-io race (read(2) side IOW gup(write) side) KOSAKI Motohiro
2009-04-14  6:25   ` KOSAKI Motohiro
2009-04-14 16:45     ` Jeff Moyer
2009-04-14 17:51       ` Andrea Arcangeli
2009-04-14 18:10         ` Jeff Moyer
2009-04-14 19:48           ` Andrea Arcangeli
2009-04-14  6:19 ` [RFC][PATCH v3 3/6] nfs, direct-io: fix fork vs direct-io race on nfs KOSAKI Motohiro
2009-04-14 16:48   ` Jeff Moyer
2009-04-14  6:20 ` [RFC][PATCH v3 4/6] aio: Don't inherit aio ring memory at fork KOSAKI Motohiro
2009-04-14 13:41   ` Andrea Arcangeli
2009-04-14 16:01   ` Jeff Moyer
2009-04-15  0:56     ` KOSAKI Motohiro
2009-04-15  2:44       ` Jeff Moyer
2009-04-15  3:00         ` KOSAKI Motohiro
2009-04-14  6:21 ` [RFC][PATCH v3 5/6] don't use bio-map in read() path KOSAKI Motohiro
2009-04-14  6:23 ` [RFC][PATCH v3 6/6] fix wrong get_user_pages usage in iovlock.c KOSAKI Motohiro
2009-04-14  6:56   ` Nick Piggin
2009-04-14  6:58     ` KOSAKI Motohiro
2009-04-15  8:48       ` KOSAKI Motohiro
2009-04-17 15:07         ` Sosnowski, Maciej
2009-04-19 12:37           ` KOSAKI Motohiro
2009-04-23 12:48             ` Sosnowski, Maciej
2009-04-14  8:41 ` [RFC][PATCH 0/6] IO pinning(get_user_pages()) vs fork race fix Nick Piggin
2009-04-14  9:19   ` KOSAKI Motohiro
2009-04-14  9:37     ` Nick Piggin [this message]
2009-04-14  6:15 KOSAKI Motohiro

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=200904141937.23584.nickpiggin@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=aarcange@redhat.com \
    --cc=akpm@osdl.org \
    --cc=davem@davemloft.net \
    --cc=jmoyer@redhat.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.org \
    --cc=torvalds@osdl.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).