]> git.baikalelectronics.ru Git - kernel.git/commit
exit: make setting exit_state consistent
authorChristian Brauner <christian@brauner.io>
Mon, 29 Jul 2019 15:48:24 +0000 (17:48 +0200)
committerChristian Brauner <christian@brauner.io>
Tue, 30 Jul 2019 17:57:14 +0000 (19:57 +0200)
commit1447c79bd5909f8527d7d09a0f7bc25acbfccae6
treee50f2c2635beacd11be8b3e8d0c305781425ab27
parent93dcb1371ef6bc623d767c4ca8c6d593a3d2585e
exit: make setting exit_state consistent

Since commit dc7d9f1acae1 ("pidfd: fix a poll race when setting exit_state")
we unconditionally set exit_state to EXIT_ZOMBIE before calling into
do_notify_parent(). This was done to eliminate a race when querying
exit_state in do_notify_pidfd().
Back then we decided to do the absolute minimal thing to fix this and
not touch the rest of the exit_notify() function where exit_state is
set.
Since this fix has not caused any issues change the setting of
exit_state to EXIT_DEAD in the autoreap case to account for the fact hat
exit_state is set to EXIT_ZOMBIE unconditionally. This fix was planned
but also explicitly requested in [1] and makes the whole code more
consistent.

/* References */
[1]: https://lore.kernel.org/lkml/CAHk-=wigcxGFR2szue4wavJtH5cYTTeNES=toUBVGsmX0rzX+g@mail.gmail.com

Signed-off-by: Christian Brauner <christian@brauner.io>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
kernel/exit.c