From: Mike Rapoport <rppt@linux.vnet.ibm.com>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Mike Kravetz <mike.kravetz@oracle.com>,
Pavel Emelyanov <xemul@virtuozzo.com>,
Hillf Danton <hillf.zj@alibaba-inc.com>
Subject: Re: [PATCH 0/3] userfaultfd non-cooperative further update for 4.11 merge window
Date: Tue, 28 Feb 2017 09:15:29 +0200 [thread overview]
Message-ID: <1488266129-8411-1-git-send-email-rppt@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170224181957.19736-1-aarcange@redhat.com>
On Fri, 24 Feb 2017 19:19:54 +0100, Andrea Arcangeli wrote:
> Hello,
>
> unfortunately I noticed one relevant bug in userfaultfd_exit while
> doing more testing. I've been doing testing before and this was also
> tested by kbuild bot and exercised by the selftest, but this bug never
> reproduced before.
>
> I dropped userfaultfd_exit as result. I dropped it because of
> implementation difficulty in receiving signals in __mmput and because
> I think -ENOSPC as result from the background UFFDIO_COPY should be
> enough already.
The -ENOSPC from UFFDIO_COPY will be enough, I believe.
> Before I decided to remove userfaultfd_exit, I noticed
> userfaultfd_exit wasn't exercised by the selftest and when I tried to
> exercise it, after moving it to a more correct place in __mmput where
> it would make more sense and where the vma list is stable, it resulted
> in the event_wait_completion in D state. So then I added the second
> patch to be sure even if we call userfaultfd_event_wait_completion too
> late during task exit(), we won't risk to generate tasks in D
> state. The same check exists in handle_userfault() for the same
> reason, except it makes a difference there, while here is just a
> robustness check and it's run under WARN_ON_ONCE.
>
> While looking at the userfaultfd_event_wait_completion() function I
> looked back at its callers too while at it and I think it's not ok to
> stop executing dup_fctx on the fcs list because we relay on
> userfaultfd_event_wait_completion to execute
> userfaultfd_ctx_put(fctx->orig) which is paired against
> userfaultfd_ctx_get(fctx->orig) in dup_userfault just before
> list_add(fcs). This change only takes care of fctx->orig but this area
> also needs further review looking for similar problems in fctx->new.
I'll take a look at fctx->new.
> The only patch that is urgent is the first because it's an use after
> free during a SMP race condition that affects all processes if
> CONFIG_USERFAULTFD=y. Very hard to reproduce though and probably
> impossible without SLUB poisoning enabled.
>
> Mike and Pavel please review, thanks!
Thanks for the fixes :)
> Andrea
>
> Andrea Arcangeli (3):
> userfaultfd: non-cooperative: rollback userfaultfd_exit
> userfaultfd: non-cooperative: robustness check
> userfaultfd: non-cooperative: release all ctx in dup_userfaultfd_complete
Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
> fs/userfaultfd.c | 47 +++++++---------------------------------
> include/linux/userfaultfd_k.h | 6 -----
> include/uapi/linux/userfaultfd.h | 5 +----
> kernel/exit.c | 1 -
> 4 files changed, 9 insertions(+), 50 deletions(-)
--
Sincerely yours,
Mike.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-02-28 7:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-24 18:19 [PATCH 0/3] userfaultfd non-cooperative further update for 4.11 merge window Andrea Arcangeli
2017-02-24 18:19 ` [PATCH 1/3] userfaultfd: non-cooperative: rollback userfaultfd_exit Andrea Arcangeli
2017-02-24 18:19 ` [PATCH 2/3] userfaultfd: non-cooperative: robustness check Andrea Arcangeli
2017-02-24 18:19 ` [PATCH 3/3] userfaultfd: non-cooperative: release all ctx in dup_userfaultfd_complete Andrea Arcangeli
2017-02-28 7:15 ` Mike Rapoport [this message]
2017-03-01 5:17 ` [PATCH 1.5/3] userfaultfd: documentation fixup after removal of UFFD_EVENT_EXIT Mike Rapoport
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=1488266129-8411-1-git-send-email-rppt@linux.vnet.ibm.com \
--to=rppt@linux.vnet.ibm.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dgilbert@redhat.com \
--cc=hillf.zj@alibaba-inc.com \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=xemul@virtuozzo.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;
as well as URLs for NNTP newsgroup(s).