Skip to content

Commit

Permalink
perf tools: do not complain if root is owning perf.data
Browse files Browse the repository at this point in the history
This improves patch fa6963b 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>
  • Loading branch information
Pierre Habouzit authored and Ingo Molnar committed Aug 28, 2009
1 parent 7ced156 commit 119e7a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 119e7a2

Please sign in to comment.