From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
David Daney <david.daney@cavium.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Jan Beulich <jbeulich@suse.com>,
Joerg Roedel <joerg.roedel@amd.com>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
Mike Galbraith <efault@gmx.de>,
Namhyung Kim <namhyung.kim@lge.com>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <peterz@infradead.org>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
Stephane Eranian <eranian@google.com>
Subject: Fixing perf top --user shortcoming was: Re: [GIT PULL 0/9] perf/core improvements and fixes
Date: Thu, 26 Jan 2012 10:22:00 -0200 [thread overview]
Message-ID: <20120126122200.GA9128@infradead.org> (raw)
In-Reply-To: <20120126111648.GH3853@elte.hu>
Em Thu, Jan 26, 2012 at 12:16:48PM +0100, Ingo Molnar escreveu:
> * Arnaldo Carvalho de Melo <acme@infradead.org> wrote:
> > The --uid feature works for root, we still need to
> > sort out that paranoia with some threads owned by a user that
> > prevents 'perf --uid non-root-user' to work for
> > 'non-root-user'.
> Just wondering what detail causes that failure - the whole point
> of --uid mingo would be to enable nonprivileged users to do
> 'session wide' profiling, *especially* if paranoia is high.
> So what does --uid do which perf record --pid 1234 wouldnt
> already do? By all means --uid ought to be a fancy way of doing
> a whole bunch of perf record --pid 1234 profiling sessions, at
> once.
I stopped at the kernel, i.e. used what can be done with what is
available from the kernel right now, the diagnosis was sent in private,
but boils down to:
+++ b/kernel/events/core.c
@@ -2636,7 +2636,8 @@ find_lively_task_by_vpid(pid_t vpid)
/* Reuse ptrace permission checks for now. */
err = -EACCES;
- if (!ptrace_may_access(task, PTRACE_MODE_READ))
+ if (perf_paranoid_tracepoint_raw() &&
+ !ptrace_may_access(task, PTRACE_MODE_READ))
goto errout;
return task;
ptrace_may_access(task, PTRACE_MODE_READ) fails for some tasks owned by
the user because, IIRC, in __ptrace_may_access:
const struct cred *cred = current_cred(), *tcred;
/* May we inspect the given task?
* This check is used both for attaching with ptrace
* and for allowing access to sensitive information in /proc.
*
* ptrace_attach denies several cases that /proc allows
* because setting up the necessary parent/child relationship
* or halting the specified task is impossible.
*/
int dumpable = 0;
<SNIP>
if (!dumpable && !task_ns_capable(task, CAP_SYS_PTRACE))
return -EPERM;
fails.
The patch above is not any kind of solution, just a way to make it work
when paranoia is set to -1 (thus perf_paranoid_tracepoint_raw in the
POC) and show where the problem lies, ideas? Peter?
> [ Btw, we should probably alias --user to --uid as well, as that
> might be the intuitive thing people would typically use? ]
I'll do that
> Anyway, pulled, thanks a lot Arnaldo!
>
> One detail: don't we want some of these fixes cherry-picked into
> perf/urgent as well?
Yeah, I'll prepare a perf-urgent-for-ingo signed tag.
> Thanks,
>
> Ingo
next prev parent reply other threads:[~2012-01-26 12:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-24 23:07 Arnaldo Carvalho de Melo
2012-01-24 23:07 ` [PATCH 1/9] perf tools: Add fprintf methods for thread_map and cpu_map classes Arnaldo Carvalho de Melo
2012-01-24 23:07 ` [PATCH 2/9] perf tools: Introduce per user view Arnaldo Carvalho de Melo
2012-01-24 23:07 ` [PATCH 3/9] perf bench: Make "default" memcpy() selection actually use glibc's implementation Arnaldo Carvalho de Melo
2012-01-24 23:07 ` [PATCH 4/9] perf bench: Also allow measuring alternative memcpy implementations Arnaldo Carvalho de Melo
2012-01-24 23:07 ` [PATCH 5/9] perf bench: Also allow measuring memset() Arnaldo Carvalho de Melo
2012-01-24 23:07 ` [PATCH 6/9] perf bench: Allow passing an iteration count to "bench mem mem{cpy,set}" Arnaldo Carvalho de Melo
2012-01-24 23:07 ` [PATCH 7/9] perf tools: Fix broken build by defining _GNU_SOURCE in Makefile Arnaldo Carvalho de Melo
2012-01-24 23:08 ` [PATCH 8/9] perf probe: Usability fixes Arnaldo Carvalho de Melo
2012-01-24 23:08 ` [PATCH 9/9] perf tools: Fix strlen() bug in perf_event__synthesize_event_type() Arnaldo Carvalho de Melo
2012-01-26 11:16 ` [GIT PULL 0/9] perf/core improvements and fixes Ingo Molnar
2012-01-26 12:22 ` Arnaldo Carvalho de Melo [this message]
2012-01-26 13:09 ` Fixing perf top --user shortcoming was: " Ingo Molnar
2012-01-26 14:30 ` Arnaldo Carvalho de Melo
2012-01-26 18:32 ` Ingo Molnar
2012-01-26 19:24 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120126122200.GA9128@infradead.org \
--to=acme@infradead.org \
--cc=david.daney@cavium.com \
--cc=dsahern@gmail.com \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jbeulich@suse.com \
--cc=joerg.roedel@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@elte.hu \
--cc=namhyung.kim@lge.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=srikar@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome