Bug 13693 - make probefunc unprivileged
Summary: make probefunc unprivileged
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: tapsets (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-15 11:48 UTC by Frank Ch. Eigler
Modified: 2012-09-28 19:47 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Ch. Eigler 2012-02-15 11:48:30 UTC
probefunc/probemod have had a funny history as to where they try to get
function name strings from.  The probe-point-parsing variant is depended
upon from the para-callgraph* examples, and that part could be well enough
unprivileged.  Other usages dip into the equivalent symdata(), which is
(rightfully?) privileged.

We should not so intermingle these.  We could deprecate the privileged
parts of probefunc(), so that in 1.8+, unprivileged scripts can use it
(for probe-point-parsing only, or some cleaner equivalent).  Or we could
write a new function to do only that, and adjust sample scripts.
Comment 1 Mark Wielaard 2012-02-15 12:01:14 UTC
Should we just recommend pn() and pp() which are unprivileged?
Comment 2 Frank Ch. Eigler 2012-02-15 12:23:54 UTC
> Should we just recommend pn() and pp() which are unprivileged?

Not so simple; for para-callgraph*, we don't want boilerplate
substrings of the pp/pn(), just the plain function names.
Comment 3 Serguei Makarov 2012-09-28 19:47:06 UTC
Building on tapset improvements from PR6580, I implemented a preprocessor conditional of the form %( systemtap_privilege == "privileged" / "unprivileged" %? ... %: ... %). The probefunc() implementation now wraps all kernel-space retrieval code in such a conditional, eliding it when compiled with a lower privilege, while leaving the user-space code available.

This allows unprivileged use of probefunc() handily, while retaining backwards compatibility with its kernel-space uses for privileged scripts (no deprecation/rewriting necessary). For instance, para-callgraph* and such can now be run in unprivileged mode, so long as the probe points they're handed are appropriate of course.

It remains to document the new systemtap_privilege check in order to make it available and documented if we want to consider it for similar uses in the future. (i.e. for having a tapset function provide a subset of the normal functionality in unprivileged mode)