Created attachment 499480 [details] testcase Description of problem: With ptraced threaded child with exited thread group leader task one should be able to waitpid somehow on it. waitpid (PID, &status, 0) will wait till all the threads will exit. I believe waitpid (PID, &status, __WNOTHREAD) should return status of the TID which equals PID. Version-Release number of selected component (if applicable): FAIL kernel-2.6.35.12-90.fc14.x86_64 FAIL kernel-smp-2.6.9-89.EL.x86_64 FAIL kernel-xen-2.6.18-238.9.1.el5.x86_64 FAIL kernel-2.6.32-71.29.1.el6.x86_64 How reproducible: Always. Steps to Reproduce: gcc -o wnothread wnothread.c -Wall -g -pthread;./wnothread ;echo $? Actual results: 1 Expected results: 0 Additional info: I will check it into ptrace-testsuite if considered as valid bug. It hangs GDB in some cases: [patch] Workaround for 10970, 12702, avoid calling waitpid http://sourceware.org/ml/gdb-patches/2011-05/msg00386.html
(In reply to comment #0) > > Description of problem: > With ptraced threaded child with exited thread group leader task one should be > able to waitpid somehow on it. waitpid (PID, &status, 0) will wait till all > the threads will exit. Yes, known oddity, I already mentioned this several times on lkml. In particular, see the recent thread: http://marc.info/?l=linux-kernel&m=130555999731900 There is additional complication with the group-leader. If it is traced and exits, do_wait(WEXITED) doesn't work (until all threads exit) for the tracer. Should be changed, I think. So yes, I believe this should be changed. But this is not trivial, and it is not clear what exactly we should do. I'll try to do this after the pending ptrace changes. > I believe waitpid (PID, &status, __WNOTHREAD) should Please note that this has nothing to do with __WNOTHREAD. This flags means: ignore the tasks/threads cloned/traced by our sub-threads.
(In reply to comment #1) > I'll try to do this after the pending ptrace changes. OK, thanks. Do whatever you like with this tracking Bug. > > I believe waitpid (PID, &status, __WNOTHREAD) should > > Please note that this has nothing to do with __WNOTHREAD. > This flags means: ignore the tasks/threads cloned/traced > by our sub-threads. OK, thanks for the info, I will forget about __WNOTHREAD.