Toby Riddell
2008-Dec-12 15:37 UTC
[dtrace-discuss] profile:::tick-1 requires dtrace_kernel privilege?
Hi all,
A user with dtrace_proc and dtrace_user privileges can see the
profile:::tick-1 probe:
$ ppriv $$
28999: -bash
flags = <none>
E: basic,dtrace_proc,dtrace_user,proc_owner
I: basic,dtrace_proc,dtrace_user,proc_owner
P: basic,dtrace_proc,dtrace_user,proc_owner
L: all
$ dtrace -l | grep tick-1
42071 profile tick-1
42072 profile tick-10
42073 profile tick-100
42075 profile tick-1000
42681 profile tick-1sec
However when I run D code using this probe I don''t see any output
unless I add the dtrace_kernel privilege.
Here the D code I am using (this is in a script that I run as dtrace
-s tick-1.d):
/*
* Count off and report the number of seconds elapsed
*/
dtrace:::BEGIN
{
i = 0;
}
profile:::tick-1
{
i = i + 1;
trace(i);
}
dtrace:::END
{
trace(i);
}
This behaviour has been verified on Solaris 10 and a recent OpenSolaris box.
Is this expected behaviour?
Thanks.
Toby
Jon Haslam
2008-Dec-12 16:09 UTC
[dtrace-discuss] profile:::tick-1 requires dtrace_kernel privilege?
Hi Toby, <chop>> However when I run D code using this probe I don''t see any output > unless I add the dtrace_kernel privilege. > > Here the D code I am using (this is in a script that I run as dtrace > -s tick-1.d): > > /* > * Count off and report the number of seconds elapsed > */ > dtrace:::BEGIN > { > i = 0; > } > > profile:::tick-1 > { > i = i + 1; > trace(i); > } > > dtrace:::END > { > trace(i); > } > > This behaviour has been verified on Solaris 10 and a recent OpenSolaris box. > > Is this expected behaviour?Expected, yes, but not particularly useful. If a user only has dtrace_user privilege then probes exported by the profile provider will only fire for that user if a process they own is executing when the probe fires. To test this, just execute a spinloop at the same time as enabling a ''profile-1s'' probe and it should fire every second (on an otherwise idle system that is). Aside from giving out dtrace_kernel privilege, I''m not aware of anything you can do to get periodic timers (maybe I''m forgetting something though...). This needs sorting out really but it''s probably a bunch of work. Jon.