]> 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, 17 Sep 2009 07:47:09 +0000 (09:47 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Oct 2009 16:32:29 +0000 (09:32 -0700)
commit 119e7a22bb70d84849384e5113792cd45afa4f85 upstream.

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>
LKML-Reference: <20090827075902.GF19653@laphroaig.corp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
tools/perf/builtin-annotate.c
tools/perf/builtin-report.c

index 5e17de984dc839d0ad86932d73bf4e2c2c85b272..5010952c1d81991b04e9cf3e2a44dc391c07ba71 100644 (file)
@@ -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);
        }
 
index 8b2ec882e6e0e8b44230c1d3648007d3d91ccbfe..b8a75f63d5351bdb662092bac1e9042c4eb17c3e 100644 (file)
@@ -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);
        }