Page MenuHomeFreeBSD

Add support for syscall::*fork:return tracing in DTrace
AbandonedPublic

Authored by gnn on Mar 13 2017, 9:38 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 25, 6:29 PM
Unknown Object (File)
Sat, Nov 23, 6:13 PM
Unknown Object (File)
Thu, Nov 21, 6:14 PM
Unknown Object (File)
Thu, Nov 21, 7:05 AM
Unknown Object (File)
Thu, Nov 7, 11:19 AM
Unknown Object (File)
Wed, Nov 6, 12:13 AM
Unknown Object (File)
Oct 15 2024, 8:25 PM
Unknown Object (File)
Oct 14 2024, 8:49 PM

Details

Reviewers
markj
graeme.jenkinson_cl.cam.ac.uk
Group Reviewers
DTrace

Diff Detail

Event Timeline

Hmm, if the return is fired here, both parent and child report the same pid (the parent's pid). It would be nice if the child reported its new pid. Why not fire in fork_return() ? One might use td_dbg_sc_code to store which fork variant we should fire the probe for.

It would be more tempting to add the systrace_probe_func invocation at the end of fork_return() where the similar KTRACE probe fires (for similar reasons). Take a look at the call to ktrsysret(SYS_fork, 0, 0); for details.

Actually it was in kern_fork() that I first looked, but, we do not have access to the syscall args structure at that point. I'll dig a bit more to see if I missed a pointer that would lead me there, or figure out if there is a reasonable way to synthesize one.

In D9987#206482, @gnn wrote:

Actually it was in kern_fork() that I first looked, but, we do not have access to the syscall args structure at that point. I'll dig a bit more to see if I missed a pointer that would lead me there, or figure out if there is a reasonable way to synthesize one.

You might consider adding a special entry point to systrace.c for this purpose. We technically only need sysent[SYS_fork], I think.