Bug 242635 - Signal 0 instead of SIGTRAP|PTRACE_EVENT_EXIT from ptrace
Signal 0 instead of SIGTRAP|PTRACE_EVENT_EXIT from ptrace
Status: CLOSED DUPLICATE of bug 242694
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
7
All Linux
low Severity low
: ---
: ---
Assigned To: Roland McGrath
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-05 03:50 EDT by Magnus Vesterlund
Modified: 2007-11-30 17:12 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-06-14 04:35:37 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Test case (1.97 KB, text/plain)
2007-06-05 03:50 EDT, Magnus Vesterlund
no flags Details

  None (edit)
Description Magnus Vesterlund 2007-06-05 03:50:22 EDT
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
they exit.

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 2.6.21.3 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):

2.6.21-1.3194.fc7

How reproducible:

Every time.

Steps to Reproduce:

1. Compile and run the attached test case.

Actual results:

Signal 0 when second thread exits.

Expected results:

Same ptrace events as vanilla kernel.

Additional info:
Comment 1 Magnus Vesterlund 2007-06-05 03:50:22 EDT
Created attachment 156182 [details]
Test case
Comment 2 Roland McGrath 2007-06-05 16:50:13 EDT
You must include what arch rpm you are using, and it's also useful to know how
many processors the machine has.
Comment 3 Magnus Vesterlund 2007-06-06 04:02:59 EDT
The machine has one Core 2 T7200 procesor (dual core). It is running the x86_64
kernel.
Comment 4 Roland McGrath 2007-06-14 04:35:37 EDT
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 ***

Note You need to log in before you can comment on or make changes to this bug.