The patch titled Subject: exit: make setting exit_state consistent has been added to the -mm tree. Its filename is exit-make-setting-exit_state-consistent.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/exit-make-setting-exit_state-consistent.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/exit-make-setting-exit_state-consistent.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/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Christian Brauner <christian@xxxxxxxxxx> Subject: exit: make setting exit_state consistent Since commit b191d6491be6 ("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 https://lore.kernel.org/lkml/CAHk-=wigcxGFR2szue4wavJtH5cYTTeNES=toUBVGsmX0rzX+g@xxxxxxxxxxxxxx and makes the whole code more consistent. Link: http://lkml.kernel.org/r/20190729162757.22694-1-christian@xxxxxxxxxx Signed-off-by: Christian Brauner <christian@xxxxxxxxxx> Acked-by: Oleg Nesterov <oleg@xxxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Prateek Sood <prsood@xxxxxxxxxxxxxx> Cc: Andrei Vagin <avagin@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/exit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/kernel/exit.c~exit-make-setting-exit_state-consistent +++ a/kernel/exit.c @@ -734,9 +734,10 @@ static void exit_notify(struct task_stru autoreap = true; } - tsk->exit_state = autoreap ? EXIT_DEAD : EXIT_ZOMBIE; - if (tsk->exit_state == EXIT_DEAD) + if (autoreap) { + tsk->exit_state = EXIT_DEAD; list_add(&tsk->ptrace_entry, &dead); + } /* mt-exec, de_thread() is waiting for group leader */ if (unlikely(tsk->signal->notify_count < 0)) _ Patches currently in -mm which might be from christian@xxxxxxxxxx are exit-make-setting-exit_state-consistent.patch