Red Hat Bugzilla – Bug 242635
Signal 0 instead of SIGTRAP|PTRACE_EVENT_EXIT from ptrace
Last modified: 2007-11-30 17:12:06 EST
Description of problem:
When tracing multithreaded programs using ptrace on a Fedora kernel, I get
strange 0 signals instead of PTRACE_EVENT_EXIT events to traced threads when
I have attached a test case that traces a process with two threads that just
exit and prints the events that ptrace reports.
If you compile the test case with "gcc -lpthread -o ptrace-bug ptrace-bug.c"
and run it on a vanilla 184.108.40.206 kernel, you get the expected messages (here
with manual annotations):
tid 25582: signal 19, ptrace event 0 SIGSTOP to parent from PTRACE_ATTACH
tid 25582: signal 5, ptrace event 3 SIGTRAP|PTRACE_EVENT_CLONE to parent
tid 25582: signal 5, ptrace event 6 SIGTRAP|PTRACE_EVENT_EXIT to parent
tid 25583: signal 19, ptrace event 0 SIGSTOP to child when created
tid 25583: signal 5, ptrace event 6 SIGTRAP|PTRACE_EVENT_EXIT to child
tid 25583: exit status 0 Exit status from child
tid 25582: exit status 0 Exit status from parent
If you run the test case on the Fedora kernel the PTRACE_EVENT_EXIT for the
second thread to exit is replaced by a signal 0:
tid 3026: signal 19, ptrace event 0
tid 3026: signal 5, ptrace event 3
tid 3026: signal 5, ptrace event 6
tid 3027: signal 19, ptrace event 0
tid 3027: signal 0, ptrace event 0 Signal 0???
tid 3027: exit status 0
tid 3026: exit status 0
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Compile and run the attached test case.
Signal 0 when second thread exits.
Same ptrace events as vanilla kernel.
Created attachment 156182 [details]
You must include what arch rpm you are using, and it's also useful to know how
many processors the machine has.
The machine has one Core 2 T7200 procesor (dual core). It is running the x86_64
This was never 100% for me, but happened on many iterations.
After my fix for bug 242694, I have never seen the "signal 0" report again.
It makes sense to me how these both lead to these two failure modes in the
different scenarios (group exit by syscall and group exit by signal).
*** This bug has been marked as a duplicate of 242694 ***