aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-05 14:44:39 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-05 14:44:39 -0500
commit9d9cc4aa004edc996ce560e57b1154f658681c05 (patch)
tree30b71e1aa3363083855edc22447c52585d04d224 /tools/perf
parentc84e6d01eed16afa41a1c4ad9a6bd6a8bfe67af0 (diff)
parentfb7df12d645cfba6a76a45fdcc7e3f7fbbcda661 (diff)
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar: "Various fixes: - synchronize kernel and tooling headers - cgroup support fix - two tooling fixes" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: tools/headers: Synchronize kernel ABI headers perf/cgroup: Fix perf cgroup hierarchy support perf tools: Unwind properly location after REJECT perf symbols: Fix memory corruption because of zero length symbols
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/annotate.c12
-rw-r--r--tools/perf/util/parse-events.l8
2 files changed, 17 insertions, 3 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 4397a8b6e6cd..aa66791b1bfc 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -606,9 +606,19 @@ static struct arch *arch__find(const char *name)
606int symbol__alloc_hist(struct symbol *sym) 606int symbol__alloc_hist(struct symbol *sym)
607{ 607{
608 struct annotation *notes = symbol__annotation(sym); 608 struct annotation *notes = symbol__annotation(sym);
609 const size_t size = symbol__size(sym); 609 size_t size = symbol__size(sym);
610 size_t sizeof_sym_hist; 610 size_t sizeof_sym_hist;
611 611
612 /*
613 * Add buffer of one element for zero length symbol.
614 * When sample is taken from first instruction of
615 * zero length symbol, perf still resolves it and
616 * shows symbol name in perf report and allows to
617 * annotate it.
618 */
619 if (size == 0)
620 size = 1;
621
612 /* Check for overflow when calculating sizeof_sym_hist */ 622 /* Check for overflow when calculating sizeof_sym_hist */
613 if (size > (SIZE_MAX - sizeof(struct sym_hist)) / sizeof(struct sym_hist_entry)) 623 if (size > (SIZE_MAX - sizeof(struct sym_hist)) / sizeof(struct sym_hist_entry))
614 return -1; 624 return -1;
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index dcfdafdc2f1c..6680e4fb7967 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -154,6 +154,10 @@ do { \
154 yycolumn += yyleng; \ 154 yycolumn += yyleng; \
155} while (0); 155} while (0);
156 156
157#define USER_REJECT \
158 yycolumn -= yyleng; \
159 REJECT
160
157%} 161%}
158 162
159%x mem 163%x mem
@@ -335,8 +339,8 @@ r{num_raw_hex} { return raw(yyscanner); }
335{num_hex} { return value(yyscanner, 16); } 339{num_hex} { return value(yyscanner, 16); }
336 340
337{modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); } 341{modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); }
338{bpf_object} { if (!isbpf(yyscanner)) REJECT; return str(yyscanner, PE_BPF_OBJECT); } 342{bpf_object} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_OBJECT); }
339{bpf_source} { if (!isbpf(yyscanner)) REJECT; return str(yyscanner, PE_BPF_SOURCE); } 343{bpf_source} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_SOURCE); }
340{name} { return pmu_str_check(yyscanner); } 344{name} { return pmu_str_check(yyscanner); }
341"/" { BEGIN(config); return '/'; } 345"/" { BEGIN(config); return '/'; }
342- { return '-'; } 346- { return '-'; }