linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* perf top -u <uid> does not seem to be working
@ 2013-11-12 23:22 Ingo Molnar
  2013-11-12 23:26 ` Ingo Molnar
  2013-11-13 17:59 ` perf top -u <uid> does not seem to be working Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 4+ messages in thread
From: Ingo Molnar @ 2013-11-12 23:22 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, David Ahern, Namhyung Kim, Jiri Olsa,
	Adrian Hunter, Frédéric Weisbecker


Hm, this is unexpected I think:

  hubble:~> perf top --stdio -u mingo
  Error:
  You may not have permission to collect stats.
  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

  hubble:~> cat /proc/sys/kernel/perf_event_paranoid 
  -1

  hubble:~> perf top --stdio -u
     Error: switch `u' requires a value

   usage: perf top [<options>]

      -u, --uid <user>      user to profile

(perf is the latest version from tip:perf/core)

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: perf top -u <uid> does not seem to be working
  2013-11-12 23:22 perf top -u <uid> does not seem to be working Ingo Molnar
@ 2013-11-12 23:26 ` Ingo Molnar
  2013-11-15  7:24   ` [tip:perf/urgent] perf top: Add missing newline if the 'uid' is invalid tip-bot for Ingo Molnar
  2013-11-13 17:59 ` perf top -u <uid> does not seem to be working Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2013-11-12 23:26 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, David Ahern, Namhyung Kim, Jiri Olsa,
	Adrian Hunter, Frédéric Weisbecker


an unrelated bug is a missing newline if the 'uid' is invalid:

  hubble:~> perf top --stdio -u help
  Error:
  Invalid User: helphubble:~> 

Fixed by the patch below.

  comet:~/tip/tools/perf> perf top --stdio -u help
  Error:
  Invalid User: help
  comet:~/tip/tools/perf> 

Signed-off-by: Ingo Molnar <mingo@kernel.org>

 tools/perf/builtin-top.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index b8f8e29..71e6402 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1172,7 +1172,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 	status = target__validate(target);
 	if (status) {
 		target__strerror(target, status, errbuf, BUFSIZ);
-		ui__warning("%s", errbuf);
+		ui__warning("%s\n", errbuf);
 	}
 
 	status = target__parse_uid(target);
@@ -1180,7 +1180,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 		int saved_errno = errno;
 
 		target__strerror(target, status, errbuf, BUFSIZ);
-		ui__error("%s", errbuf);
+		ui__error("%s\n", errbuf);
 
 		status = -saved_errno;
 		goto out_delete_evlist;


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: perf top -u <uid> does not seem to be working
  2013-11-12 23:22 perf top -u <uid> does not seem to be working Ingo Molnar
  2013-11-12 23:26 ` Ingo Molnar
@ 2013-11-13 17:59 ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-11-13 17:59 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Namhyung Kim, Jiri Olsa,
	Adrian Hunter, Frédéric Weisbecker

Em Wed, Nov 13, 2013 at 12:22:49AM +0100, Ingo Molnar escreveu:
> Hm, this is unexpected I think:
> 
>   hubble:~> perf top --stdio -u mingo
>   Error:
>   You may not have permission to collect stats.
>   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
> 
>   hubble:~> cat /proc/sys/kernel/perf_event_paranoid 
>   -1
> 
> (perf is the latest version from tip:perf/core)

https://lkml.org/lkml/2012/1/26/142

Fell thru the cracks, summary:

> > > +++ 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.

- Arnaldo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:perf/urgent] perf top: Add missing newline if the 'uid' is invalid
  2013-11-12 23:26 ` Ingo Molnar
@ 2013-11-15  7:24   ` tip-bot for Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Ingo Molnar @ 2013-11-15  7:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, hpa, mingo, namhyung, jolsa, fweisbec,
	adrian.hunter, dsahern, tglx

Commit-ID:  ea432a8bb940e6bea2aaeca3c0ff3d931ad81f2e
Gitweb:     http://git.kernel.org/tip/ea432a8bb940e6bea2aaeca3c0ff3d931ad81f2e
Author:     Ingo Molnar <mingo@kernel.org>
AuthorDate: Wed, 13 Nov 2013 00:26:09 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 14 Nov 2013 15:59:50 -0300

perf top: Add missing newline if the 'uid' is invalid

Add missing newline if the 'uid' is invalid:

  hubble:~> perf top --stdio -u help
  Error:
  Invalid User: helphubble:~>

Fixed by this patch:

  comet:~/tip/tools/perf> perf top --stdio -u help
  Error:
  Invalid User: help
  comet:~/tip/tools/perf>

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20131112232609.GA31474@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index b8f8e29..71e6402 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1172,7 +1172,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 	status = target__validate(target);
 	if (status) {
 		target__strerror(target, status, errbuf, BUFSIZ);
-		ui__warning("%s", errbuf);
+		ui__warning("%s\n", errbuf);
 	}
 
 	status = target__parse_uid(target);
@@ -1180,7 +1180,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 		int saved_errno = errno;
 
 		target__strerror(target, status, errbuf, BUFSIZ);
-		ui__error("%s", errbuf);
+		ui__error("%s\n", errbuf);
 
 		status = -saved_errno;
 		goto out_delete_evlist;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-15  7:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-12 23:22 perf top -u <uid> does not seem to be working Ingo Molnar
2013-11-12 23:26 ` Ingo Molnar
2013-11-15  7:24   ` [tip:perf/urgent] perf top: Add missing newline if the 'uid' is invalid tip-bot for Ingo Molnar
2013-11-13 17:59 ` perf top -u <uid> does not seem to be working Arnaldo Carvalho de Melo

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 NNTP newsgroup(s).