Bug 247971 - PTRACE_SETOPTIONS reports wrong status in multi-threaded prog
PTRACE_SETOPTIONS reports wrong status in multi-threaded prog
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
7
i386 Linux
low Severity medium
: ---
: ---
Assigned To: Kernel Maintainer List
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-07-12 09:13 EDT by Tom Horsley
Modified: 2007-11-30 17:12 EST (History)
1 user (show)

See Also:
Fixed In Version: 2.6.22.1-33.fc7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-07-27 10:44:53 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)
exitcode.c source code to demo bug (3.93 KB, text/plain)
2007-07-12 21:48 EDT, Tom Horsley
no flags Details

  None (edit)
Description Tom Horsley 2007-07-12 09:13:49 EDT
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-12 21:48:32 EDT
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-12 21:51:06 EDT
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 10:44:53 EDT
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.