public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: Stephane Eranian <eranian@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Namhyung Kim <namhyung.kim@lge.com>, Jiri Olsa <jolsa@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	"mingo@elte.hu" <mingo@elte.hu>
Subject: Re: [BUG] perf record: --uid=x fails
Date: Tue, 15 Jan 2013 11:58:45 -0300	[thread overview]
Message-ID: <20130115145845.GC8768@infradead.org> (raw)
In-Reply-To: <CABPqkBStWUyv_vwb9jgWe0hirMNe=J1g_V7z69piajr1pTPt=g@mail.gmail.com>

Em Mon, Jan 14, 2013 at 03:14:02PM +0100, Stephane Eranian escreveu:
> Hi,
> 
> I was trying to use the --uid option of perf record but it fails for
> me no matter
> what I tried. Looks like the goal of this option is to measure ALL the processes
> owned by the specified uid. Each process is measured in per-thread mode.
> 
> However for me it failed on all my attempts when running with 3.8.0-rc3 on
> Ubuntu Quantal.
> 
> $ perf record --uid=eranian sleep 4
> Error:
> Permission error - are you root?
> Consider tweaking /proc/sys/kernel/perf_event_paranoid:
>  -1 - Not paranoid at all
>   0 - Disallow raw tracepoint access for unpriv
>   1 - Disallow cpu events for unpriv
>   2 - Disallow kernel profiling for unpriv
> sleep: Terminated
> 
> You don't want to be root to run this command.  Should not require

But you have to due to the problem you noticed below.

> to measure the processes I own. So the error message is confusing
> here.

indeed
 
> After some debugging, I came to the conclusion that this command
> fails when it hits the sshd daemon:
> 
> eranian   2439  0.0  0.0 110424  1968 ?        S    15:07   0:00 sshd:
> eranian@pts/2
> root      2301  0.0  0.0 110424  4420 ?        Ss   15:07   0:00 sshd:
> eranian [priv]
> 
> I mean the sshd process owned by me. It is owned by me but I cannot attached
> an event to it. I get EACCES and I suspect it's because of missing
> ptrace privilege.
> The sshd binary is obviously not setuid. So there is something else preventing
> ptrace. In fact, even strace -p 2349 fails. Looked online and there
> were a couple
> of mentions to the Yama security model and the ptrace_scope sysctl
> control. I tried
> that and it did not help.
> 
> So looks to me that something is broken somewhere. If the kernel
> restrictions are
> normal, then I think perf record should warn that it has to skip the
> sshd process and
> continue with the other processes owned by me. That  seems more useful than the
> current situation. But I may be missing something here. If so please
> explain to me.

Right, I need to resume working on properly fixing this, I got
sidetracked when I got the same point as you in the above analysis :-\

Will try to recover the conversations I had about this.

- Arnaldo

  reply	other threads:[~2013-01-15 14:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-14 14:14 [BUG] perf record: --uid=x fails Stephane Eranian
2013-01-15 14:58 ` Arnaldo Carvalho de Melo [this message]
2013-01-16 12:55   ` Stephane Eranian

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=20130115145845.GC8768@infradead.org \
    --to=acme@redhat.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung.kim@lge.com \
    --cc=peterz@infradead.org \
    /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