From: Nick Piggin <npiggin@suse.de>
To: Robin Holt <holt@sgi.com>
Cc: Hugh Dickins <hugh@veritas.com>,
Linus Torvalds <torvalds@osdl.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] get_user_pages(..., write==1, ...) may return with readable pte.
Date: Sat, 14 Oct 2006 06:53:06 +0200 [thread overview]
Message-ID: <20061014045305.GA23740@wotan.suse.de> (raw)
In-Reply-To: <20061013203342.GA21610@lnx-holt.americas.sgi.com>
On Fri, Oct 13, 2006 at 03:33:42PM -0500, Robin Holt wrote:
> Handle the case in get_user_pages() when a call to __handle_mm_fault()
> inserts a writable pte, and a process doing dup_mmap converts it
> to readable before get_user_pages() does the subsequent request to
> follow_page().
>
>
> Signed-off-by: Robin Holt <holt@sgi.com>
>
> ---
>
> Hugh, Nick, and Linus,
>
> I think I have tripped over another flavor of a get_user_pages bug
> we addressed back in 2005. I do not have a test case to prove it is
> the issue I am trying to address, but I have done as thorough a code
> walk-through as I can.
>
> Assume a pte is currently empty. A first pthread is in the kernel on
> a call path which is leading to get_user_pages. A second pthread is
> in the process of doing a fork. The process doing get_user_pages()
> gets into __handle_mm_fault() and grabs ptl just before the process
> doing a fork attempts to grab the ptl to convert the pages to COW.
> __handle_mm_fault() will insert the writable pte and unlock ptl then
> return with VM_FAULT_WRITE set. The process doing a fork then gets
> the lock and starts converting the pte to RO/COW. The get_user_pages()
> process then clears FOLL_WRITE from foll_flags and calls follow_page()
> without write, adds to the map count for the page, but does not have a
> writable mapping.
Hi Robin,
dup_mmap holds mmap_sem for write. get_user_pages caller must hold it
for read.
So it think it is OK? But if not, then you can't just get rid of this
FOLL_WRITE bit, because then we get infinite loops when a 'force'
write access (eg. ptrace setting a breakpoint in text).
next prev parent reply other threads:[~2006-10-14 4:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-13 20:33 Robin Holt
2006-10-14 4:53 ` Nick Piggin [this message]
2006-10-14 5:10 ` Nick Piggin
2006-10-14 10:15 ` Robin Holt
2006-10-15 8:03 ` Nick Piggin
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=20061014045305.GA23740@wotan.suse.de \
--to=npiggin@suse.de \
--cc=holt@sgi.com \
--cc=hugh@veritas.com \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®