The logic is correct. Just I think it would be tidier to avoid setting utrace->stopped when the task is dead. It doesn't hurt, but it is not needed (and _looks_ confusing imho).
We can just return true, this is enough for the caller. In fact, it seems to me "if (exit_state)" case is not needed at all, see "[PATCH 3/3]". Signed-off-by: Oleg Nesterov <o...@redhat.com> --- __UTRACE/kernel/utrace.c~5_EXIT_STATE_STOPPED 2009-08-26 14:55:51.000000000 +0200 +++ __UTRACE/kernel/utrace.c 2009-08-26 16:53:49.000000000 +0200 @@ -668,7 +668,7 @@ static bool utrace_do_stop(struct task_s * utrace_report_death(), or never will. */ if (!(target->utrace_flags & _UTRACE_DEATH_EVENTS)) - utrace->stopped = stopped = true; + stopped = true; } else if (task_is_stopped(target)) { /* * Stopped is considered quiescent; when it wakes up, it will