Bug 242635 - Signal 0 instead of SIGTRAP|PTRACE_EVENT_EXIT from ptrace
Summary: Signal 0 instead of SIGTRAP|PTRACE_EVENT_EXIT from ptrace
Keywords:
Status: CLOSED DUPLICATE of bug 242694
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 7
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Roland McGrath
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-06-05 07:50 UTC by Magnus Vesterlund
Modified: 2007-11-30 22:12 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-06-14 08:35:37 UTC
Type: ---
Embargoed:


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

Description Magnus Vesterlund 2007-06-05 07:50:22 UTC
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 07:50:22 UTC
Created attachment 156182 [details]
Test case

Comment 2 Roland McGrath 2007-06-05 20:50:13 UTC
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 08:02:59 UTC
The machine has one Core 2 T7200 procesor (dual core). It is running the x86_64
kernel.

Comment 4 Roland McGrath 2007-06-14 08:35:37 UTC
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.