mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] perf record: Don't try to find buildids in a zero sized file
@ 2010-03-11 18:53 Arnaldo Carvalho de Melo
  2010-03-11 18:53 ` [PATCH 2/2] perf record: Mention paranoid sysctl when failing to create counter Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-03-11 18:53 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo,
	Frédéric Weisbecker, Mike Galbraith, Peter Zijlstra,
	Paul Mackerras, stable

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Fixing this symptom:

[acme@mica linux-2.6-tip]$ perf record -a -f
  Fatal: Permission error - are you root?

Bus error
[acme@mica linux-2.6-tip]$

I.e. if for some reason no data is collected, in this case a non root user
trying to do systemwide profiling, no data will be collected, and then we end
up trying to mmap a zero sized file and access the file header, b00m.

Reported-by: Ingo Molnar <mingo@elte.hu>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: stable@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index f573bbb..3bf1409 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -394,6 +394,9 @@ static int process_buildids(void)
 {
 	u64 size = lseek(output, 0, SEEK_CUR);
 
+	if (size == 0)
+		return 0;
+
 	session->fd = output;
 	return __perf_session__process_events(session, post_processing_offset,
 					      size - post_processing_offset,
-- 
1.5.5.1


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

* [PATCH 2/2] perf record: Mention paranoid sysctl when failing to create counter
  2010-03-11 18:53 [PATCH 1/2] perf record: Don't try to find buildids in a zero sized file Arnaldo Carvalho de Melo
@ 2010-03-11 18:53 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-03-11 18:53 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo,
	Frédéric Weisbecker, Mike Galbraith, Peter Zijlstra,
	Paul Mackerras

From: Arnaldo Carvalho de Melo <acme@redhat.com>

[acme@mica linux-2.6-tip]$ perf record -a -f
  Fatal: Permission error - are you root?
	 Consider tweaking /proc/sys/kernel/perf_event_paranoid.

[acme@mica linux-2.6-tip]$

Suggested-by: Ingo Molnar <mingo@elte.hu>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 3bf1409..b280ab5 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -283,7 +283,8 @@ try_again:
 		int err = errno;
 
 		if (err == EPERM || err == EACCES)
-			die("Permission error - are you root?\n");
+			die("Permission error - are you root?\n"
+			    "\t Consider tweaking /proc/sys/kernel/perf_event_paranoid.\n");
 		else if (err ==  ENODEV && profile_cpu != -1)
 			die("No such device - did you specify an out-of-range profile CPU?\n");
 
-- 
1.5.5.1


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

end of thread, other threads:[~2010-03-11 18:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-11 18:53 [PATCH 1/2] perf record: Don't try to find buildids in a zero sized file Arnaldo Carvalho de Melo
2010-03-11 18:53 ` [PATCH 2/2] perf record: Mention paranoid sysctl when failing to create counter 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

all inboxes | Powered by JetHome®