Bug 663860 - syscall.fork.return never sees $return == 0
syscall.fork.return never sees $return == 0
Product: Fedora
Classification: Fedora
Component: systemtap (Show other bugs)
x86_64 Linux
low Severity low
: ---
: ---
Assigned To: Frank Ch. Eigler
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2010-12-16 23:27 EST by Jan Kratochvil
Modified: 2010-12-23 16:28 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-12-23 16:28:16 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
fork.stp (461 bytes, text/plain)
2010-12-16 23:27 EST, Jan Kratochvil
no flags Details
fork.c (100 bytes, text/plain)
2010-12-16 23:28 EST, Jan Kratochvil
no flags Details

  None (edit)
Description Jan Kratochvil 2010-12-16 23:27:13 EST
Created attachment 469284 [details]

Description of problem:
Tried to create an `strace -f' systemtap variant but I cannot.

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

How reproducible:

Steps to Reproduce:
gcc -o /tmp/fork /tmp/fork.c -Wall -g
stap /tmp/fork.stp -c /tmp/fork

Actual results:

Expected results:

Additional info:
Comment 1 Jan Kratochvil 2010-12-16 23:28:00 EST
Component typo, sorry.
Comment 2 Jan Kratochvil 2010-12-16 23:28:37 EST
Created attachment 469285 [details]
Comment 3 Josh Stone 2010-12-17 17:09:28 EST
Process forking at the kernel level doesn't have the same dual-return semantics that the userspace sees.  However, all newly-forked threads go through schedule_tail on their way back to userspace, so that may be a better probe for you.  There's even a "kprocess.start" probepoint already defined in the tapsets for this purpose.

Also be aware that our syscall.fork is on the kernel's do_fork function, which 
covers vfork and clone too.  So if you only want new processes, and not threads, you may need to do some filtering on the flags.
Comment 4 Jan Kratochvil 2010-12-23 16:28:16 EST
Thanks, it really works.  Not sure if systemtap should not emulate the userland visible behavior but the functionality is there.

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