[DTrace-devel] syscall trampoline and handling args

Kris Van Hees kris.van.hees at oracle.com
Mon Mar 23 10:35:58 PDT 2020


On Mon, Mar 23, 2020 at 01:28:30PM -0400, Kris Van Hees wrote:
> On Sun, Mar 22, 2020 at 05:30:27PM -0700, Eugene Loh wrote:
> > I think there is a problem with the syscall trampoline's handling of 
> > args.  I intend to prepare a patch, but will describe here where I'm 
> > going in case there is feedback I should consider.
> 
> There is and there isn't :)  See below...
> 
> > Currently, the syscall trampoline copies some arguments, the number of 
> > which is set by some dtp_argc, which corresponds to some "representative 
> > probe."  The problem is that this number of arguments is not necessarily 
> > the same for every probe that matches the user's probe description.  
> > E.g., consider "dtrace -n syscall:::entry".  If one examines the 
> > /sys/kernel/debug/tracing/events/syscalls/sys_enter_*/format files, as 
> > tp_event_info() does, then one finds a varying number of args, from 0 to 
> > 6.  The number that we copy is set by the "representative probe" -- in 
> > essence, a "random" value.  This works for some number of other probes.  
> > For probes that have more arguments, however, the additional args will 
> > not be copied.  For probes that have fewer arguments, the BPF program 
> > will not even attach to the probe; the PERF_EVENT_IOC_SET_BPF ioctl in 
> > dt_bpf_attach() will error.
> 
> Actually the problem is a side effect of your code to allow groups of probes
> to be associated with a single program.

Let me rephrase this...  the problem you are seeing here is only noticable in
your personal tree because the released code and the code in my tree is still
limited by only being able to compile code for a single probe at a time.  Your
solution for being able to handle probe descriptions that match multiple probes
(which I am still reviewing because I need to evaluate some parts of it in
terms of other aspects of the compiler and program handling) triggers this
issue as one of the areas where I am still reviewing your code because the fix
for the wildcard probe description support is more involved than just the area
you have touched so far.

But this is a good problem to have found!

	Kris



More information about the DTrace-devel mailing list