Bug 242694 - utrace: PTRACE_EVENT_EXIT report gets wrong wait status for group exit
utrace: PTRACE_EVENT_EXIT report gets wrong wait status for group exit
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
7
All Linux
low Severity low
: ---
: ---
Assigned To: Roland McGrath
Brian Brock
:
: 242635 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-05 10:04 EDT by Magnus Vesterlund
Modified: 2007-11-30 17:12 EST (History)
2 users (show)

See Also:
Fixed In Version: 2.6.22.1-27.fc7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-07-24 10:38:02 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 (2.75 KB, text/plain)
2007-06-05 10:04 EDT, Magnus Vesterlund
no flags Details
test case for second failure scenario (2.11 KB, text/x-csrc)
2007-06-14 04:37 EDT, Roland McGrath
no flags Details

  None (edit)
Description Magnus Vesterlund 2007-06-05 10:04:18 EDT
Description of problem:

When tracing a multithreaded program that is killed by a signal using ptrace on
a Fedora kernel, I get very strange events reported by ptrace.

I have attached a test case that traces a process with two threads, sends a
SIGINT signal to the threads and prints the events that ptrace reports.

If you compile the test case with "gcc -lpthread -o ptrace-bug2 ptrace-bug2.c"
and run it on a vanilla 2.6.21.3 kernel, you get the expected messages (here
with manual annotations):

tid 2992: signal 19, ptrace event 0    SIGSTOP to parent from PTRACE_ATTACH
tid 2992: signal 5, ptrace event 3     SIGTRAP|PTRACE_EVENT_CLONE to parent
Sending SIGINT
tid 2992: signal 2, ptrace event 0     SIGINT reaches the process
Delivering SIGINT
tid 2992: signal 5, ptrace event 6     SIGTRAP|PTRACE_EVENT_EXIT to parent
tid 2993: signal 5, ptrace event 6     SIGTRAP|PTRACE_EVENT_EXIT to child
tid 2993: terminated by signal 2       Child killed by signal
tid 2992: terminated by signal 2       Parent killed by signal

If you run the test case on the Fedora kernel the signal is reported multiple
times, and you don't get and PTRACE_EVENT_EXIT events:

tid 3201: signal 19, ptrace event 0
tid 3201: signal 5, ptrace event 3
Sending SIGINT
tid 3201: signal 2, ptrace event 0
Delivering SIGINT
tid 3201: signal 2, ptrace event 0     SIGINT reported again???
Delivering SIGINT
tid 3202: signal 2, ptrace event 0     And again???
Delivering SIGINT
tid 3202: terminated by signal 2
tid 3201: terminated by signal 2

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:

SIGINT reported multiple times, no PTRACE_EVENT_EXIT events.

Expected results:

Same ptrace events as vanilla kernel.

Additional info:
Comment 1 Magnus Vesterlund 2007-06-05 10:04:18 EDT
Created attachment 156221 [details]
Test case
Comment 2 Roland McGrath 2007-06-06 21:18:31 EDT
Reproduced on my upstream+utrace devel kernel on x86_64.
Comment 3 Roland McGrath 2007-06-14 04:13:50 EDT
I've fixed this in the utrace development code.
Comment 4 Roland McGrath 2007-06-14 04:35:40 EDT
*** Bug 242635 has been marked as a duplicate of this bug. ***
Comment 5 Roland McGrath 2007-06-14 04:37:28 EDT
Created attachment 156966 [details]
test case for second failure scenario

Bug 242635 had this second test case for the same underlying bug.
Comment 6 Magnus Vesterlund 2007-07-24 04:58:40 EDT
The fix seems to have gotten into kernel-2.6.22.1-27.fc7, at least I can't
reproduce the problem any more.

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