The patch titled Subject: userfaultfd: non-cooperative: robustness check has been added to the -mm tree. Its filename is userfaultfd-non-cooperative-robustness-check.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/userfaultfd-non-cooperative-robustness-check.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/userfaultfd-non-cooperative-robustness-check.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andrea Arcangeli <aarcange@xxxxxxxxxx> Subject: userfaultfd: non-cooperative: robustness check Similar to the handle_userfault() case, also make sure to never attempt to send any event past the PF_EXITING point of no return. This is purely a robustness check. Link: http://lkml.kernel.org/r/20170224181957.19736-3-aarcange@xxxxxxxxxx Signed-off-by: Andrea Arcangeli <aarcange@xxxxxxxxxx> Acked-by: Mike Rapoport <rppt@xxxxxxxxxxxxxxxxxx> Cc: "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Pavel Emelyanov <xemul@xxxxxxxxxxxxx> Cc: Hillf Danton <hillf.zj@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/userfaultfd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff -puN fs/userfaultfd.c~userfaultfd-non-cooperative-robustness-check fs/userfaultfd.c --- a/fs/userfaultfd.c~userfaultfd-non-cooperative-robustness-check +++ a/fs/userfaultfd.c @@ -529,8 +529,13 @@ out: static int userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx, struct userfaultfd_wait_queue *ewq) { - int ret = 0; + int ret; + ret = -1; + if (WARN_ON_ONCE(current->flags & PF_EXITING)) + goto out; + + ret = 0; ewq->ctx = ctx; init_waitqueue_entry(&ewq->wq, current); @@ -565,7 +570,7 @@ static int userfaultfd_event_wait_comple * ctx may go away after this if the userfault pseudo fd is * already released. */ - +out: userfaultfd_ctx_put(ctx); return ret; } _ Patches currently in -mm which might be from aarcange@xxxxxxxxxx are userfaultfd-shmem-__do_fault-requires-vm_fault_nopage.patch userfaultfd-non-cooperative-rollback-userfaultfd_exit.patch userfaultfd-non-cooperative-robustness-check.patch userfaultfd-non-cooperative-release-all-ctx-in-dup_userfaultfd_complete.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html