public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug runtime/12877] New: task_finder doesn't get non-standard exec's right
@ 2011-06-10 20:26 dsmith at redhat dot com
  2011-06-10 20:41 ` [Bug runtime/12877] " dsmith at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dsmith at redhat dot com @ 2011-06-10 20:26 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=12877

           Summary: task_finder doesn't get non-standard exec's right
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: runtime
        AssignedTo: systemtap@sourceware.org
        ReportedBy: dsmith@redhat.com


While debugging BZ699342, I found that when a thread does an exec (which it
isn't supposed to do), the task_finder doesn't get the resulting events quite
right.  The task_finder also mishandles an exec without a preceeding fork()
incorrectly.  Things work correctly in the normal fork/exec case.

The problem occurs on exec.  When the exec happens, the new program text has
already overlaid the old program text.  The task_finder needs to notify clients
that the original program is gone (if it was "interesting") and check out the
new program (to see if it is "interesting").

To see if the original program was "interesting", it looks up the path of the
parent process.  However, in the case of a thread doing an exec or just an
exec() with no fork(), this will mean task_finder is looking at the wrong path.
 This causes task_finder to miss the original program going away.

A possible solution to this problem is for the task_finder to use a task
specific utrace exec callback for exec (as it does for death).  Then
task_finder wouldn't need to do a path-based lookup, it would just know that
this task was an interesting one.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug runtime/12877] task_finder doesn't get non-standard exec's right
  2011-06-10 20:26 [Bug runtime/12877] New: task_finder doesn't get non-standard exec's right dsmith at redhat dot com
@ 2011-06-10 20:41 ` dsmith at redhat dot com
  2011-06-10 20:42 ` dsmith at redhat dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: dsmith at redhat dot com @ 2011-06-10 20:41 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=12877

--- Comment #1 from David Smith <dsmith at redhat dot com> 2011-06-10 20:41:31 UTC ---
Created attachment 5788
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5788
test program

Test program that execs 'sleep 5'.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug runtime/12877] task_finder doesn't get non-standard exec's right
  2011-06-10 20:26 [Bug runtime/12877] New: task_finder doesn't get non-standard exec's right dsmith at redhat dot com
  2011-06-10 20:41 ` [Bug runtime/12877] " dsmith at redhat dot com
@ 2011-06-10 20:42 ` dsmith at redhat dot com
  2011-06-10 20:48 ` dsmith at redhat dot com
  2011-06-17 16:23 ` dsmith at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: dsmith at redhat dot com @ 2011-06-10 20:42 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=12877

--- Comment #2 from David Smith <dsmith at redhat dot com> 2011-06-10 20:42:02 UTC ---
Created attachment 5789
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5789
test script

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug runtime/12877] task_finder doesn't get non-standard exec's right
  2011-06-10 20:26 [Bug runtime/12877] New: task_finder doesn't get non-standard exec's right dsmith at redhat dot com
  2011-06-10 20:41 ` [Bug runtime/12877] " dsmith at redhat dot com
  2011-06-10 20:42 ` dsmith at redhat dot com
@ 2011-06-10 20:48 ` dsmith at redhat dot com
  2011-06-17 16:23 ` dsmith at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: dsmith at redhat dot com @ 2011-06-10 20:48 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=12877

--- Comment #3 from David Smith <dsmith at redhat dot com> 2011-06-10 20:47:45 UTC ---
To see this behavior, run stap on the test script in one terminal, then start
the test program in another terminal.  The output will look something like
this:

1307738373 - process 12877_test (0xffff88003a148000) begin: 6380, 6380
1307738373 - process sleep (0xffff88003a148000) begin: 6380, 6380
1307738378 - process 12877_test (0xffff88003a148000) end: 6380, 6380
1307738378 - process sleep (0xffff88003a148000) end: 6380, 6380

12877_test starts, so the program("12877_test").begin probe fires.  The test
program immediately does an exec, so the task_finder should have caused the
program("12877_test").end probe to fire, but it didn't.  Instead "sleep 5" runs
to completion (as you can see by the 5 second time lapse), then both
program.end probes fire.

Instead, the output should have looked like:

1307738373 - process 12877_test (0xffff88003a148000) begin: 6380, 6380
1307738373 - process 12877_test (0xffff88003a148000) end: 6380, 6380
1307738373 - process sleep (0xffff88003a148000) begin: 6380, 6380
1307738378 - process sleep (0xffff88003a148000) end: 6380, 6380

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug runtime/12877] task_finder doesn't get non-standard exec's right
  2011-06-10 20:26 [Bug runtime/12877] New: task_finder doesn't get non-standard exec's right dsmith at redhat dot com
                   ` (2 preceding siblings ...)
  2011-06-10 20:48 ` dsmith at redhat dot com
@ 2011-06-17 16:23 ` dsmith at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: dsmith at redhat dot com @ 2011-06-17 16:23 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=12877

David Smith <dsmith at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from David Smith <dsmith at redhat dot com> 2011-06-17 16:22:53 UTC ---
Fixed in commit acaf72f.  Also added a testcase to look at 3 types of exec:

- fork/exec
- exec (no fork)
- multi-threaded exec

The new code should be more efficient than the old code (since we no longer
look up the exec'ed process parent's path to see if it is "interesting").

One possible complication with the new code is that if the utrace exec handlers
get called in the wrong order it could look like the exec'ed program started
before the original one ended.  I haven't seen this problem on either the old
RHEL5 version of utrace or the current version.

Regression tested on:

rhel5: 2.6.18-238.12.1.el5debug (x86_64), 2.6.18-267.el5 (ia64)
rhel6: 2.6.32-131.2.1.el6.x86_64
f14: 2.6.35.13-91.fc14.i686.PAE
f15: 2.6.38.6-27.fc15.x86_64

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-17 16:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-10 20:26 [Bug runtime/12877] New: task_finder doesn't get non-standard exec's right dsmith at redhat dot com
2011-06-10 20:41 ` [Bug runtime/12877] " dsmith at redhat dot com
2011-06-10 20:42 ` dsmith at redhat dot com
2011-06-10 20:48 ` dsmith at redhat dot com
2011-06-17 16:23 ` dsmith at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).