From: Brian Geffon <bgeffon@google.com>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: Peter Xu <peterx@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
Mike Rapoport <rppt@linux.vnet.ibm.com>,
Sonny Rao <sonnyrao@google.com>,
"Kirill A . Shutemov" <kirill@shutemov.name>
Subject: Re: [RFC PATCH] userfaultfd: Address race after fault.
Date: Mon, 17 Feb 2020 20:37:07 -0600 [thread overview]
Message-ID: <CADyq12wjRLTEJALQwAbskHyTonbxTT8XR=WD74jzaGydgJ6HDw@mail.gmail.com> (raw)
In-Reply-To: <20200218022655.GE29216@redhat.com>
Hi Andrea,
That all makes sense, thanks so much for that detailed explanation.
Brian
On Mon, Feb 17, 2020 at 8:27 PM Andrea Arcangeli <aarcange@redhat.com> wrote:
>
> On Mon, Feb 17, 2020 at 07:50:19PM -0600, Brian Geffon wrote:
> > But in the meantime, if the plan of record will be to always allow
> > retrying then shouldn't the block I mailed a patch on be removed
> > regardless because do_user_addr_fault always starts with
> > FAULT_FLAG_ALLOW_RETRY and we shouldn't ever land there without it in
> > the future and allows userfaultfd to retry?
>
> It might hide the limitation but only if the page fault originated in
> userland (Android's case), but that's not something userfault users
> should depend on. Userfaults (unlike sigsegv trapping) are meant to be
> reliable and transparent to all user and kernel accesses alike.
>
> It is also is unclear how long Android will be forced to keep doing
> bounce buffers copies in RAM before considering passing any memory to
> kernel syscalls.
>
> For all other users where the kernel access may be the one triggering
> the fault the patch will remove a debug aid and the kernel fault would
> then fail by hitting on the below:
>
> /* Not returning to user mode? Handle exceptions or die: */
> no_context(regs, hw_error_code, address, SIGBUS, BUS_ADRERR);
>
> There may be more side effects in other archs I didn't evaluate
> because there's no other place where the common code can return
> VM_FAULT_RETRY despite the arch code explicitly told the common code
> it can't do that (by not setting FAULT_FLAG_ALLOW_RETRY) so it doesn't
> look very safe and it doesn't seem a generic enough solution to the
> problem.
>
> That dump_stack() helped a lot to identify those kernel outliers that
> erroneously use get_user_pages instead of the gup_locked/unlocked
> variant that are uffd-capable.
>
> Thanks,
> Andrea
>
prev parent reply other threads:[~2020-02-18 2:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-14 22:58 Brian Geffon
2020-02-14 23:19 ` Andrea Arcangeli
2020-02-15 14:29 ` Brian Geffon
2020-02-17 16:07 ` Peter Xu
2020-02-18 1:50 ` Brian Geffon
2020-02-18 2:26 ` Andrea Arcangeli
2020-02-18 2:37 ` Brian Geffon [this message]
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='CADyq12wjRLTEJALQwAbskHyTonbxTT8XR=WD74jzaGydgJ6HDw@mail.gmail.com' \
--to=bgeffon@google.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.com \
--cc=rppt@linux.vnet.ibm.com \
--cc=sonnyrao@google.com \
/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