This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug runtime/14223] New: perf probes fail if not root
- From: "dsmith at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sourceware dot org
- Date: Mon, 11 Jun 2012 19:43:06 +0000
- Subject: [Bug runtime/14223] New: perf probes fail if not root
- Auto-submitted: auto-generated
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.