]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
perf tools: do not complain if root is owning perf.data
authorPierre Habouzit <pierre.habouzit@intersec.com>
Thu, 27 Aug 2009 07:59:02 +0000 (09:59 +0200)
committerIngo Molnar <mingo@elte.hu>
Fri, 28 Aug 2009 11:47:43 +0000 (13:47 +0200)
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>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: <stable@kernel.org>
LKML-Reference: <20090827075902.GF19653@laphroaig.corp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/builtin-annotate.c
tools/perf/builtin-report.c

index 4ac618b34254ab8db10a459e373f1a96c79e31bb..4c7bc4436236e55a9796b4dc9e1a1cccf97d1e62 100644 (file)
@@ -984,8 +984,8 @@ static int __cmd_annotate(void)
                exit(-1);
        }
 
-       if (!force && (input_stat.st_uid != geteuid())) {
-               fprintf(stderr, "file: %s not owned by current user\n", input_name);
+       if (!force && input_stat.st_uid && (input_stat.st_uid != geteuid())) {
+               fprintf(stderr, "file: %s not owned by current user or root\n", input_name);
                exit(-1);
        }
 
index d2e28820ee6000dfea38dd1c72d389470c7ab5fa..ea6328a893cc45c26294b0e9096be1013c3107e7 100644 (file)
@@ -1405,8 +1405,8 @@ static int __cmd_report(void)
                exit(-1);
        }
 
-       if (!force && (input_stat.st_uid != geteuid())) {
-               fprintf(stderr, "file: %s not owned by current user\n", input_name);
+       if (!force && input_stat.st_uid && (input_stat.st_uid != geteuid())) {
+               fprintf(stderr, "file: %s not owned by current user or root\n", input_name);
                exit(-1);
        }