Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

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'

Reviewed-by: David Ahern <>
Cc: David Ahern <>
Cc: Eric Dumazet <>
Cc: Ingo Molnar <>
Cc: Neil Horman <>
Cc: Paul Mackerras <>
Cc: Peter Zijlstra <>
Cc: Steven Rostedt <>
Signed-off-by: Jiri Olsa <>
Signed-off-by: Arnaldo Carvalho de Melo <>
  • Loading branch information...
commit 8e303f20f4b3611615118a22a737fd2dc7c4ef81 1 parent 2b022a8
Jiri Olsa authored Arnaldo Carvalho de Melo committed
Showing with 5 additions and 2 deletions.
  1. +5 −2 tools/perf/util/evsel.c
7 tools/perf/util/evsel.c
@@ -449,6 +449,8 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
if (type & PERF_SAMPLE_RAW) {
+ const u64 *pdata;
u.val64 = *array;
if (WARN_ONCE(swapped,
"Endianness of raw data not corrected!\n")) {
@@ -462,11 +464,12 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
return -EFAULT;
data->raw_size = u.val32[0];
+ pdata = (void *) array + sizeof(u32);
- if (sample_overlap(event, &u.val32[1], data->raw_size))
+ if (sample_overlap(event, pdata, data->raw_size))
return -EFAULT;
- data->raw_data = &u.val32[1];
+ data->raw_data = (void *) pdata;
return 0;
Please sign in to comment.
Something went wrong with that request. Please try again.