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

Roland McGrath roland at redhat.com
Sat Jun 2 00:18:27 UTC 2007


> > I think the (leader->flags & TCB_ATTACHED) case there may also be wrong if
> > leader->flags has TCB_EXITING.  It should skip the PTRACE_KILL and detach
> > when leader is already TCB_EXITING.  
> 
> That PTRACE_KILL should not harm even if the leader is already dead.
> But it definitely should not try to `detach(leader)' as either if it was
> already TCB_EXITING or if it was alive `detach(leader)' would get locked up.
> Testcase for the latter case is attached.
> 
> While I believe your intention was a changed code condition I cannot find
> a counterexample failing the patched code.  In the worst case there should be
> double (triple...) PTRACE_KILL.

I think a test case for this needs to have the initial thread call
pthread_exit while other threads are still alive for a while longer.
Then the leader will be TCB_EXITING and dead when the other thread's
exit call leads to handle_group_exit.

Can you try to reproduce that, and then amend your patch to check
TCB_EXITING in the attached-leader case?  The PTRACE_KILL is indeed
harmless (will just fail), but should be skipped too.


Thanks,
Roland




More information about the Strace-devel mailing list