All of lore.kernel.org
 help / color / mirror / Atom feed
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: Re: Fixing perf top --user shortcoming was: Re: [GIT PULL 0/9] perf/core improvements and fixes
Date: Thu, 26 Jan 2012 12:30:37 -0200	[thread overview]
Message-ID: <20120126143037.GD9128@infradead.org> (raw)
In-Reply-To: <20120126130919.GA20115@elte.hu>

Em Thu, Jan 26, 2012 at 02:09:19PM +0100, Ingo Molnar escreveu:
> * Arnaldo Carvalho de Melo <acme@infradead.org> wrote:
> > > 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:

> Which tasks are these, are they privileged in any sense?

IIRC one of them was a child of sshd, that runs as root and then changes
the child ownership to the user logging in.

I'll continue investigation but probably for now the first thing to do
is to just remove them from the thread_map when they return -EPERM.
 
> If yes and if most of the 'real' tasks a user have can be 
> profiled just fine then i think we should just skip the 
> privileged tasks and not abort the profiling session?

Yeah, that can be done, while debugging I'll emit a warning with the
resulting thread_map of "special tasks" to figure out what makes them
special.

- Arnaldo

  reply	other threads:[~2012-01-26 14:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-24 23:07 [GIT PULL 0/9] perf/core improvements and fixes 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   ` Fixing perf top --user shortcoming was: " Arnaldo Carvalho de Melo
2012-01-26 13:09     ` Ingo Molnar
2012-01-26 14:30       ` Arnaldo Carvalho de Melo [this message]
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=20120126143037.GD9128@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.