diff options
author | Jiri Olsa <jolsa@redhat.com> | 2011-09-29 11:05:08 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-09-29 15:29:53 -0400 |
commit | 8e303f20f4b3611615118a22a737fd2dc7c4ef81 (patch) | |
tree | 15fd6d83c5bd196bc28f0cb07d714dda5b7a80e1 /tools/perf/util/evsel.c | |
parent | 2b022a82a01737012155b5ba462db74232ff1f2e (diff) |
perf tools: Fix raw sample reading
Wrong pointer is being passed for raw data sanity checking, when parsing
sample event.
This ends up with invalid event and perf record being stuck in
__perf_session__process_events function during processing build IDs
(process_buildids function).
Following command hangs up in my setup:
./perf record -e raw_syscalls:sys_enter ls
The fix is to use proper pointer to the raw data instead of the 'u'
union.
Reviewed-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1317308709-9474-2-git-send-email-jolsa@redhat.com
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/evsel.c')
-rw-r--r-- | tools/perf/util/evsel.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index c5748c52318f..e389815078d3 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -449,6 +449,8 @@ int perf_event__parse_sample(const union perf_event *event, u64 type, | |||
449 | } | 449 | } |
450 | 450 | ||
451 | if (type & PERF_SAMPLE_RAW) { | 451 | if (type & PERF_SAMPLE_RAW) { |
452 | const u64 *pdata; | ||
453 | |||
452 | u.val64 = *array; | 454 | u.val64 = *array; |
453 | if (WARN_ONCE(swapped, | 455 | if (WARN_ONCE(swapped, |
454 | "Endianness of raw data not corrected!\n")) { | 456 | "Endianness of raw data not corrected!\n")) { |
@@ -462,11 +464,12 @@ int perf_event__parse_sample(const union perf_event *event, u64 type, | |||
462 | return -EFAULT; | 464 | return -EFAULT; |
463 | 465 | ||
464 | data->raw_size = u.val32[0]; | 466 | data->raw_size = u.val32[0]; |
467 | pdata = (void *) array + sizeof(u32); | ||
465 | 468 | ||
466 | if (sample_overlap(event, &u.val32[1], data->raw_size)) | 469 | if (sample_overlap(event, pdata, data->raw_size)) |
467 | return -EFAULT; | 470 | return -EFAULT; |
468 | 471 | ||
469 | data->raw_data = &u.val32[1]; | 472 | data->raw_data = (void *) pdata; |
470 | } | 473 | } |
471 | 474 | ||
472 | return 0; | 475 | return 0; |