Bug 247971 - PTRACE_SETOPTIONS reports wrong status in multi-threaded prog
Summary: PTRACE_SETOPTIONS reports wrong status in multi-threaded prog
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 7
Hardware: i386
OS: Linux
low
medium
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-07-12 13:13 UTC by Tom Horsley
Modified: 2007-11-30 22:12 UTC (History)
1 user (show)

Fixed In Version: 2.6.22.1-33.fc7
Clone Of:
Environment:
Last Closed: 2007-07-27 14:44:53 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
exitcode.c source code to demo bug (3.93 KB, text/plain)
2007-07-13 01:48 UTC, Tom Horsley
no flags Details

Description Tom Horsley 2007-07-12 13:13:49 UTC
Description of problem:

If I'm a debugger, and I call:
ptrace(PTRACE_SETOPTIONS, kid, 0, PTRACE_O_TRACEEXIT)
for a child process I'm debugging, and if that child
process is multi-threaded, then when the process
calls _exit(0) instead of the SIGTRAP with the PTRACE_EVENT_EXIT
code in the exit status that I expect, I get a 0x7f status
that means "stopped with signal 0"


Version-Release number of selected component (if applicable):

This is in the i686 2.6.21-1.3228.fc7 kernel on my fedora 7
box (dual xeon system).

How reproducible:

every time I run the test program (which I'll attach).

Steps to Reproduce:
1. gcc -o exitcode exitcode.c -lpthread && ./exitcode
  
Actual results:

gcc -o exitcode -g exitcode.c -lpthread && ./exitcode
waitpid status: 0x7f
FAIL: unexpected stop signal 0

Expected results:

gcc -o exitcode -g exitcode.c -lpthread && ./exitcode
waitpid status: 0x6057f
PASS: got SIGTRAP with event code PTRACE_EVENT_EXIT

Additional info:

I tried the test program on both rhel4 and rhel5 systems and it
got expected results (but they were uniprocessors, so if it has
something to do with thread timing that might not be an interesting
result).

Comment 1 Tom Horsley 2007-07-13 01:48:32 UTC
Created attachment 159113 [details]
exitcode.c source code to demo bug

I swear I included this in the initial bugzilla report, but I
just noticed the program doesn't seem to be attached. Trying again.

Comment 2 Tom Horsley 2007-07-13 01:51:06 UTC
This also fails on my x86_64 fedora 7 system with kernel 2.6.21-1.3228.fc7,
so it doesn't appear to be unique to i386.

Comment 3 Tom Horsley 2007-07-27 14:44:53 UTC
Just tried the test program again with the newest 2.6.22.1-33.fc7 kernel
update, and this bug appears to be fixed. I now see the proper
PTRACE_EVENT_EXIT flag. I guess I'll try marking this as fixed in the
current release and see how badly confused I get when I try :-).


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