9638187192
There is an issue where the wrong process exit code is given to the parent when a process exits. This happens when the process has pthreads running user code i.e. not within a cancel point / system call. Why does this happen ? When exit() is called, the following steps are done: - group_kill_children(), which tells the children to die via pthread_cancel() Then, one of two things can happen: 1. if the child is in a cancel point, it gets scheduled to allow it to leave the cancel point and gets destroyed immediately 2. if the child is not in a cancel point, a "cancel pending" flag is set and the child will die when the next cancel point is encountered So what is the problem here? The last thread alive dispatches SIGCHLD to the parent, which carries the process's exit code. The group head has the only meaningful exit code and this is what should be passed. However, in the second case, the group head exits before the child, taking the process exit code to its grave. The child that was alive will exit next and will pass its "status" to the parent process, but this status is not the correct value to pass. This commit fixes the issue by passing the group head's exit code ALWAYS to the parent process. |
||
---|---|---|
.. | ||
exit.c | ||
Make.defs | ||
spawn.h | ||
task_activate.c | ||
task_cancelpt.c | ||
task_create.c | ||
task_delete.c | ||
task_execve.c | ||
task_exit.c | ||
task_exithook.c | ||
task_getgroup.c | ||
task_getpid.c | ||
task_getppid.c | ||
task_gettid.c | ||
task_init.c | ||
task_posixspawn.c | ||
task_prctl.c | ||
task_recover.c | ||
task_reparent.c | ||
task_restart.c | ||
task_setcancelstate.c | ||
task_setcanceltype.c | ||
task_setup.c | ||
task_spawn.c | ||
task_spawnparms.c | ||
task_start.c | ||
task_starthook.c | ||
task_terminate.c | ||
task_testcancel.c | ||
task_tls_alloc.c | ||
task_vfork.c | ||
task.h |