Commit 9c937688 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'perfcounters-fixes-for-linus' of...

Merge branch 'perfcounters-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'perfcounters-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  perf_counter: Fix typo in read() output generation
  perf tools: Check perf.data owner
parents 87bcfa33 4464fcaa
...@@ -1791,7 +1791,7 @@ static int perf_counter_read_group(struct perf_counter *counter, ...@@ -1791,7 +1791,7 @@ static int perf_counter_read_group(struct perf_counter *counter,
size += err; size += err;
list_for_each_entry(sub, &leader->sibling_list, list_entry) { list_for_each_entry(sub, &leader->sibling_list, list_entry) {
err = perf_counter_read_entry(counter, read_format, err = perf_counter_read_entry(sub, read_format,
buf + size); buf + size);
if (err < 0) if (err < 0)
return err; return err;
......
...@@ -31,6 +31,7 @@ static char *vmlinux = "vmlinux"; ...@@ -31,6 +31,7 @@ static char *vmlinux = "vmlinux";
static char default_sort_order[] = "comm,symbol"; static char default_sort_order[] = "comm,symbol";
static char *sort_order = default_sort_order; static char *sort_order = default_sort_order;
static int force;
static int input; static int input;
static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
...@@ -1334,6 +1335,11 @@ static int __cmd_annotate(void) ...@@ -1334,6 +1335,11 @@ static int __cmd_annotate(void)
exit(-1); exit(-1);
} }
if (!force && (stat.st_uid != geteuid())) {
fprintf(stderr, "file: %s not owned by current user\n", input_name);
exit(-1);
}
if (!stat.st_size) { if (!stat.st_size) {
fprintf(stderr, "zero-sized file, nothing to do!\n"); fprintf(stderr, "zero-sized file, nothing to do!\n");
exit(0); exit(0);
...@@ -1439,6 +1445,7 @@ static const struct option options[] = { ...@@ -1439,6 +1445,7 @@ static const struct option options[] = {
"input file name"), "input file name"),
OPT_STRING('s', "symbol", &sym_hist_filter, "symbol", OPT_STRING('s', "symbol", &sym_hist_filter, "symbol",
"symbol to annotate"), "symbol to annotate"),
OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
OPT_BOOLEAN('v', "verbose", &verbose, OPT_BOOLEAN('v', "verbose", &verbose,
"be more verbose (show symbol address, etc)"), "be more verbose (show symbol address, etc)"),
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
......
...@@ -38,6 +38,7 @@ static char *dso_list_str, *comm_list_str, *sym_list_str, ...@@ -38,6 +38,7 @@ static char *dso_list_str, *comm_list_str, *sym_list_str,
static struct strlist *dso_list, *comm_list, *sym_list; static struct strlist *dso_list, *comm_list, *sym_list;
static char *field_sep; static char *field_sep;
static int force;
static int input; static int input;
static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
...@@ -1856,6 +1857,11 @@ static int __cmd_report(void) ...@@ -1856,6 +1857,11 @@ static int __cmd_report(void)
exit(-1); exit(-1);
} }
if (!force && (stat.st_uid != geteuid())) {
fprintf(stderr, "file: %s not owned by current user\n", input_name);
exit(-1);
}
if (!stat.st_size) { if (!stat.st_size) {
fprintf(stderr, "zero-sized file, nothing to do!\n"); fprintf(stderr, "zero-sized file, nothing to do!\n");
exit(0); exit(0);
...@@ -2064,6 +2070,7 @@ static const struct option options[] = { ...@@ -2064,6 +2070,7 @@ static const struct option options[] = {
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"), "dump raw trace in ASCII"),
OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"), OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
OPT_BOOLEAN('m', "modules", &modules, OPT_BOOLEAN('m', "modules", &modules,
"load module symbols - WARNING: use only with -k and LIVE kernel"), "load module symbols - WARNING: use only with -k and LIVE kernel"),
OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples, OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment