Skip to content

Commit 907c311

Browse files
committed
exit: Fix the exit_code for wait_task_zombie
The function wait_task_zombie is defined to always returns the process not thread exit status. Unfortunately when process group exit support was added to wait_task_zombie the WNOWAIT case was overlooked. Usually tsk->exit_code and tsk->signal->group_exit_code will be in sync so fixing this is bug probably has no effect in practice. But fix it anyway so that people aren't scratching their heads about why the two code paths are different. History-Tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git Fixes: 2c66151 ("[PATCH] sys_exit() threading improvements, BK-curr") Link: https://lkml.kernel.org/r/20220103213312.9144-3-ebiederm@xmission.com Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
1 parent 270b654 commit 907c311

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

kernel/exit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,8 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)
10181018
return 0;
10191019

10201020
if (unlikely(wo->wo_flags & WNOWAIT)) {
1021-
status = p->exit_code;
1021+
status = (p->signal->flags & SIGNAL_GROUP_EXIT)
1022+
? p->signal->group_exit_code : p->exit_code;
10221023
get_task_struct(p);
10231024
read_unlock(&tasklist_lock);
10241025
sched_annotate_sleep();

0 commit comments

Comments
 (0)