[patch] Multithreaded process left Stopped (T) on CTRL-C of strace

Roland McGrath roland at redhat.com
Wed Jun 13 02:34:15 UTC 2007

> Thank's this was a good idea, included the testcase and fixed the code
> appropriately.  Neither PTRACE_KILL nor SIGKILL work but SIGSTOP looks
> fine for the leader task.  I only hope there is no race.

I am not very confident about this SIGSTOP you introduced.  What we've been
discussing, and AFAIK what you have tested thoroughly here, is the
TCB_EXITING case, so the introduction of SIGSTOP is speculative.

If the leader thread is alive and processes SIGSTOP before the dying thread
processes its exit, there could be some fallout with the real parent seeing
the job control stop before the death.

If we are indeed sure that the group exit will happen, then one option here
is just to leave the leader attached (and maybe stopped) while the exiting
thread finishes.  Then the leader (and all other threads) will die, and we
would reap/detach on the next wait call that tells us about its death.

This is all a murky area.  I think the right thing to do first is just put
in the change for the TCB_EXITING case, and not perturb the current
PTRACE_KILL/detach there at the same time.  After that, check on all the
failure scenarios that have been experienced, and see what problem we
really have left.  I'd rather leave something dubious as it is than
introduce a new kind of bad behavior.


More information about the Strace-devel mailing list