* [Bug runtime/14223] New: perf probes fail if not root
@ 2012-06-11 19:43 dsmith at redhat dot com
2012-06-12 15:37 ` [Bug runtime/14223] " fche at redhat dot com
2014-03-26 1:50 ` jistone at redhat dot com
0 siblings, 2 replies; 3+ messages in thread
From: dsmith at redhat dot com @ 2012-06-11 19:43 UTC (permalink / raw)
To: systemtap
http://sourceware.org/bugzilla/show_bug.cgi?id=14223
Bug #: 14223
Summary: perf probes fail if not root
Product: systemtap
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: runtime
AssignedTo: systemtap@sourceware.org
ReportedBy: dsmith@redhat.com
Classification: Unclassified
On rawhide (3.5.0-0.rc1.git0.1.fc18.x86_64).
As root, the following one-liner works fine:
====
# sudo /usr/local/bin/stap -ve 'probe perf.sw.cpu_clock { exit() }'
Pass 1: parsed user script and 85 library script(s) using
202020virt/23848res/2800shr/21660data kb, in 150usr/30sys/178real ms.
Pass 2: analyzed script: 1 probe(s), 1 function(s), 0 embed(s), 0 global(s)
using 202416virt/24640res/2968shr/22056data kb, in 0usr/0sys/6real ms.
Pass 3: using cached
/root/.systemtap/cache/73/stap_7333e571f12104c405ac9f21508f723b_902.c
Pass 4: using cached
/root/.systemtap/cache/73/stap_7333e571f12104c405ac9f21508f723b_902.ko
Pass 5: starting run.
Pass 5: run completed in 20usr/30sys/337real ms.
====
But, as myself, the perf probe registrations fails (even though I'm in
stapusr/stapdev):
====
# groups
dsmith wheel users stapusr stapdev
# /usr/local/bin/stap -ve 'probe perf.sw.cpu_clock { exit() }'
Pass 1: parsed user script and 85 library script(s) using
204136virt/24432res/2884shr/21676data kb, in 150usr/20sys/178real ms.
Pass 2: analyzed script: 1 probe(s), 1 function(s), 0 embed(s), 0 global(s)
using 204532virt/24960res/2956shr/22072data kb, in 10usr/0sys/6real ms.
Pass 3: using cached
/home/dsmith/.systemtap/cache/7d/stap_7d3ce5a812ac75c47b94040fadd2de76_905.c
Pass 4: using cached
/home/dsmith/.systemtap/cache/7d/stap_7d3ce5a812ac75c47b94040fadd2de76_905.ko
Pass 5: starting run.
ERROR: probe perf.type(1).config(0).sample(1000000) registration error (rc -13)
WARNING: /usr/local/bin/staprun exited with status: 1
Pass 5: run completed in 10usr/40sys/60real ms.
Pass 5: run failed. Try again with another '--vp 00001' option.
====
From looking at the source and doing some debugging, it looks like the
following code in find_get_context() (called by
perf_event_create_kernel_counter()) is failing:
====
find_get_context(struct pmu *pmu, struct task_struct *task, int cpu)
{
struct perf_event_context *ctx;
struct perf_cpu_context *cpuctx;
unsigned long flags;
int ctxn, err;
if (!task) {
/* Must be root to operate on a CPU event: */
if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN))
return ERR_PTR(-EACCES);
====
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug runtime/14223] perf probes fail if not root
2012-06-11 19:43 [Bug runtime/14223] New: perf probes fail if not root dsmith at redhat dot com
@ 2012-06-12 15:37 ` fche at redhat dot com
2014-03-26 1:50 ` jistone at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: fche at redhat dot com @ 2012-06-12 15:37 UTC (permalink / raw)
To: systemtap
http://sourceware.org/bugzilla/show_bug.cgi?id=14223
Frank Ch. Eigler <fche at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fche at redhat dot com
--- Comment #1 from Frank Ch. Eigler <fche at redhat dot com> 2012-06-12 15:37:08 UTC ---
Wacky. It's strange for a deeper-down kernel api to enforce authorization, as
opposed to a close-to-userspace syscall handler, but alas. We should
investigate whether this part of the module runs during a callback caused by
(setuid-root) staprun vs. (unprivileged) stapio that staprun execs. If the
latter, we may be able to "fix" it by having some probe registration occur
earlier, perhaps with an additional transport message.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug runtime/14223] perf probes fail if not root
2012-06-11 19:43 [Bug runtime/14223] New: perf probes fail if not root dsmith at redhat dot com
2012-06-12 15:37 ` [Bug runtime/14223] " fche at redhat dot com
@ 2014-03-26 1:50 ` jistone at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: jistone at redhat dot com @ 2014-03-26 1:50 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=14223
Josh Stone <jistone at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |jistone at redhat dot com
Resolution|--- |FIXED
--- Comment #2 from Josh Stone <jistone at redhat dot com> ---
commit ad6c8f90a60ee9c223e31e1d61c066d7c9a6a6b4
Rather than messing with early registration, I chose to use schedule_work() to
run this bit on an events/X kernel thread.
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-26 1:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-11 19:43 [Bug runtime/14223] New: perf probes fail if not root dsmith at redhat dot com
2012-06-12 15:37 ` [Bug runtime/14223] " fche at redhat dot com
2014-03-26 1:50 ` jistone at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).