]> www.infradead.org Git - users/jedix/linux-maple.git/commit
userfaultfd: don't block on the last VM updates at exit time
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 1 Mar 2016 19:56:22 +0000 (11:56 -0800)
committerDhaval Giani <dhaval.giani@oracle.com>
Fri, 20 Jan 2017 18:55:43 +0000 (13:55 -0500)
commit05ac7fe138bcac08248f692d77b2c743340d6cda
tree5d9d120d58d995505ab7890f5b1e498d6b5234bb
parentefb811a93ae539df2b4da6b6ac52a4ba1f442f82
userfaultfd: don't block on the last VM updates at exit time

Orabug: 21685254

The exit path will do some final updates to the VM of an exiting process
to inform others of the fact that the process is going away.

That happens, for example, for robust futex state cleanup, but also if
the parent has asked for a TID update when the process exits (we clear
the child tid field in user space).

However, at the time we do those final VM accesses, we've already
stopped accepting signals, so the usual "stop waiting for userfaults on
signal" code in fs/userfaultfd.c no longer works, and the process can
become an unkillable zombie waiting for something that will never
happen.

To solve this, just make handle_userfault() abort any user fault
handling if we're already in the exit path past the signal handling
state being dead (marked by PF_EXITING).

This VM special case is pretty ugly, and it is possible that we should
look at finalizing signals later (or move the VM final accesses
earlier).  But in the meantime this is a fairly minimally intrusive fix.

Reported-and-tested-by: Dmitry Vyukov <dvyukov@google.com>
Acked-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 39680f50ae54cbbb6e72ac38b8329dd3eb9105f4)
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: Dhaval Giani <dhaval.giani@oracle.com>
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
fs/userfaultfd.c