[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-d8bd9e0aedabcb47887712497bc386a06ddcbd12@git.kernel.org>
Date: Mon, 7 Dec 2009 05:31:02 GMT
From: tip-bot for Xiao Guangrong <xiaoguangrong@...fujitsu.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, paulus@...ba.org, hpa@...or.com,
mingo@...hat.com, lizf@...fujitsu.com, penberg@...helsinki.fi,
peterz@...radead.org, eduard.munteanu@...ux360.ro,
xiaoguangrong@...fujitsu.com, fweisbec@...il.com,
hirofumi@...l.parknet.co.jp, tglx@...utronix.de, mingo@...e.hu
Subject: [tip:perf/urgent] perf_event: Fix raw event processing
Commit-ID: d8bd9e0aedabcb47887712497bc386a06ddcbd12
Gitweb: http://git.kernel.org/tip/d8bd9e0aedabcb47887712497bc386a06ddcbd12
Author: Xiao Guangrong <xiaoguangrong@...fujitsu.com>
AuthorDate: Mon, 7 Dec 2009 12:06:29 +0800
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Mon, 7 Dec 2009 06:26:24 +0100
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@...fujitsu.com>
Cc: Pekka Enberg <penberg@...helsinki.fi>
Cc: Eduard - Gabriel Munteanu <eduard.munteanu@...ux360.ro>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Li Zefan <lizf@...fujitsu.com>
LKML-Reference: <4B1C7F45.5080105@...fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
tools/perf/builtin-kmem.c | 11 ++++++++---
tools/perf/builtin-sched.c | 11 ++++++++---
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index f218990..f84d7a3 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -289,13 +289,17 @@ static void process_free_event(struct raw_event_sample *raw,
}
static void
-process_raw_event(event_t *raw_event __used, void *more_data,
+process_raw_event(event_t *raw_event __used, u32 size, void *data,
int cpu, u64 timestamp, struct thread *thread)
{
- struct raw_event_sample *raw = more_data;
+ struct raw_event_sample *raw;
struct event *event;
int type;
+ raw = malloc_or_die(sizeof(*raw)+size);
+ raw->size = size;
+ memcpy(raw->data, data, size);
+
type = trace_parse_common_type(raw->data);
event = trace_find_event(type);
@@ -345,7 +349,8 @@ static int process_sample_event(event_t *event)
dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid);
- process_raw_event(event, data.raw_data, data.cpu, data.time, thread);
+ process_raw_event(event, data.raw_size, data.raw_data, data.cpu,
+ data.time, thread);
return 0;
}
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 7481ebd..4655e16 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,
}
static void
-process_raw_event(event_t *raw_event __used, void *more_data,
+process_raw_event(event_t *raw_event __used, u32 size, void *data,
int cpu, u64 timestamp, struct thread *thread)
{
- struct raw_event_sample *raw = more_data;
+ struct raw_event_sample *raw;
struct event *event;
int type;
+ raw = malloc_or_die(sizeof(*raw)+size);
+ raw->size = size;
+ memcpy(raw->data, data, size);
+
type = trace_parse_common_type(raw->data);
event = trace_find_event(type);
@@ -1629,7 +1633,8 @@ static int process_sample_event(event_t *event)
if (profile_cpu != -1 && profile_cpu != (int)data.cpu)
return 0;
- process_raw_event(event, data.raw_data, data.cpu, data.time, thread);
+ process_raw_event(event, data.raw_size, data.raw_data, data.cpu,
+ data.time, thread);
return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists