Bug 663860

Summary: syscall.fork.return never sees $return == 0
Product: [Fedora] Fedora Reporter: Jan Kratochvil <jan.kratochvil>
Component: systemtapAssignee: Frank Ch. Eigler <fche>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 13CC: dsmith, dvlasenk, fche, jistone, mjw, roland, wcohen
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-12-23 21:28:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
fork.stp
none
fork.c none

Description Jan Kratochvil 2010-12-17 04:27:13 UTC
Created attachment 469284 [details]
fork.stp

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

Version-Release number of selected component (if applicable):
systemtap-1.3-3.fc13.x86_64
kernel-2.6.35.6-48.fc14.x86_64

How reproducible:
Always.

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

Actual results:
<nothing>

Expected results:
NEVER HIT

Additional info:

Comment 1 Jan Kratochvil 2010-12-17 04:28:00 UTC
Component typo, sorry.

Comment 2 Jan Kratochvil 2010-12-17 04:28:37 UTC
Created attachment 469285 [details]
fork.c

Comment 3 Josh Stone 2010-12-17 22:09:28 UTC
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 21:28:16 UTC
Thanks, it really works.  Not sure if systemtap should not emulate the userland visible behavior but the functionality is there.