public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf tools: do not complain if root is owning perf.data
@ 2009-08-26 13:05 Pierre Habouzit
  2009-08-26 18:24 ` Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre Habouzit @ 2009-08-26 13:05 UTC (permalink / raw)
  To: Ingo Molnar, Paul Mackerras, Peter Zijlstra; +Cc: linux-kernel

This improves patch fa6963b24 so that perf.data stuff that has been dumped
as root can be read (annotate/report) by a user without the use of the
--force.

Rationale is that root has plenty of ways to screw us (usually) that do
not require twisted schemes involving specially crafting a perf.data.

Signed-off-by: Pierre Habouzit <pierre.habouzit@intersec.com>
---
 tools/perf/builtin-annotate.c |    4 ++--
 tools/perf/builtin-report.c   |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 5e17de9..5010952 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -1335,8 +1335,8 @@ static int __cmd_annotate(void)
 		exit(-1);
 	}
 
-	if (!force && (stat.st_uid != geteuid())) {
-		fprintf(stderr, "file: %s not owned by current user\n", input_name);
+	if (!force && stat.st_uid && (stat.st_uid != geteuid())) {
+		fprintf(stderr, "file: %s not owned by current user or root\n", input_name);
 		exit(-1);
 	}
 
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 8b2ec88..b8a75f6 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1857,8 +1857,8 @@ static int __cmd_report(void)
 		exit(-1);
 	}
 
-	if (!force && (stat.st_uid != geteuid())) {
-		fprintf(stderr, "file: %s not owned by current user\n", input_name);
+	if (!force && stat.st_uid && (stat.st_uid != geteuid())) {
+		fprintf(stderr, "file: %s not owned by current user or root\n", input_name);
 		exit(-1);
 	}
 
-- 
1.6.4.1.331.gda1d56


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

end of thread, other threads:[~2009-08-28 11:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-26 13:05 [PATCH] perf tools: do not complain if root is owning perf.data Pierre Habouzit
2009-08-26 18:24 ` Ingo Molnar
2009-08-27  7:59   ` [PATCH v2] " Pierre Habouzit
2009-08-28 11:49     ` Ingo Molnar
2009-08-28 11:52     ` [tip:perfcounters/core] " tip-bot for Pierre Habouzit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox