diff options
author | Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> | 2009-12-06 23:06:29 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-07 00:26:24 -0500 |
commit | d8bd9e0aedabcb47887712497bc386a06ddcbd12 (patch) | |
tree | b8fbdb8987323a3b572554ebe00487d444abfec4 /tools/perf/builtin-sched.c | |
parent | c0777c5aa835a97ccc77d82e55388940f0140a61 (diff) |
perf_event: Fix raw event processing
We use 'data.raw_data' parameter to call process_raw_event(),
but data.raw_data buffer not include data size. it can make perf
tool crash.
This bug was introduced by commit 180f95e29a ("perf: Make common
SAMPLE_EVENT parser").
Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4B1C7F45.5080105@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-sched.c')
-rw-r--r-- | tools/perf/builtin-sched.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 7481ebdb17ef..4655e16b929b 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -1570,13 +1570,17 @@ process_sched_migrate_task_event(struct raw_event_sample *raw, | |||
1570 | } | 1570 | } |
1571 | 1571 | ||
1572 | static void | 1572 | static void |
1573 | process_raw_event(event_t *raw_event __used, void *more_data, | 1573 | process_raw_event(event_t *raw_event __used, u32 size, void *data, |
1574 | int cpu, u64 timestamp, struct thread *thread) | 1574 | int cpu, u64 timestamp, struct thread *thread) |
1575 | { | 1575 | { |
1576 | struct raw_event_sample *raw = more_data; | 1576 | struct raw_event_sample *raw; |
1577 | struct event *event; | 1577 | struct event *event; |
1578 | int type; | 1578 | int type; |
1579 | 1579 | ||
1580 | raw = malloc_or_die(sizeof(*raw)+size); | ||
1581 | raw->size = size; | ||
1582 | memcpy(raw->data, data, size); | ||
1583 | |||
1580 | type = trace_parse_common_type(raw->data); | 1584 | type = trace_parse_common_type(raw->data); |
1581 | event = trace_find_event(type); | 1585 | event = trace_find_event(type); |
1582 | 1586 | ||
@@ -1629,7 +1633,8 @@ static int process_sample_event(event_t *event) | |||
1629 | if (profile_cpu != -1 && profile_cpu != (int)data.cpu) | 1633 | if (profile_cpu != -1 && profile_cpu != (int)data.cpu) |
1630 | return 0; | 1634 | return 0; |
1631 | 1635 | ||
1632 | process_raw_event(event, data.raw_data, data.cpu, data.time, thread); | 1636 | process_raw_event(event, data.raw_size, data.raw_data, data.cpu, |
1637 | data.time, thread); | ||
1633 | 1638 | ||
1634 | return 0; | 1639 | return 0; |
1635 | } | 1640 | } |