Skip to content

Commit 9c93768

Browse files
committed
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
2 parents 87bcfa3 + 4464fca commit 9c93768

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

kernel/perf_counter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1791,7 +1791,7 @@ static int perf_counter_read_group(struct perf_counter *counter,
17911791
size += err;
17921792

17931793
list_for_each_entry(sub, &leader->sibling_list, list_entry) {
1794-
err = perf_counter_read_entry(counter, read_format,
1794+
err = perf_counter_read_entry(sub, read_format,
17951795
buf + size);
17961796
if (err < 0)
17971797
return err;

tools/perf/builtin-annotate.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ static char *vmlinux = "vmlinux";
3131
static char default_sort_order[] = "comm,symbol";
3232
static char *sort_order = default_sort_order;
3333

34+
static int force;
3435
static int input;
3536
static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
3637

@@ -1334,6 +1335,11 @@ static int __cmd_annotate(void)
13341335
exit(-1);
13351336
}
13361337

1338+
if (!force && (stat.st_uid != geteuid())) {
1339+
fprintf(stderr, "file: %s not owned by current user\n", input_name);
1340+
exit(-1);
1341+
}
1342+
13371343
if (!stat.st_size) {
13381344
fprintf(stderr, "zero-sized file, nothing to do!\n");
13391345
exit(0);
@@ -1439,6 +1445,7 @@ static const struct option options[] = {
14391445
"input file name"),
14401446
OPT_STRING('s', "symbol", &sym_hist_filter, "symbol",
14411447
"symbol to annotate"),
1448+
OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
14421449
OPT_BOOLEAN('v', "verbose", &verbose,
14431450
"be more verbose (show symbol address, etc)"),
14441451
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,

tools/perf/builtin-report.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static char *dso_list_str, *comm_list_str, *sym_list_str,
3838
static struct strlist *dso_list, *comm_list, *sym_list;
3939
static char *field_sep;
4040

41+
static int force;
4142
static int input;
4243
static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
4344

@@ -1856,6 +1857,11 @@ static int __cmd_report(void)
18561857
exit(-1);
18571858
}
18581859

1860+
if (!force && (stat.st_uid != geteuid())) {
1861+
fprintf(stderr, "file: %s not owned by current user\n", input_name);
1862+
exit(-1);
1863+
}
1864+
18591865
if (!stat.st_size) {
18601866
fprintf(stderr, "zero-sized file, nothing to do!\n");
18611867
exit(0);
@@ -2064,6 +2070,7 @@ static const struct option options[] = {
20642070
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
20652071
"dump raw trace in ASCII"),
20662072
OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
2073+
OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
20672074
OPT_BOOLEAN('m', "modules", &modules,
20682075
"load module symbols - WARNING: use only with -k and LIVE kernel"),
20692076
OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples,

0 commit comments

Comments
 (0)