linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: acme@redhat.com, a.p.zijlstra@chello.nl, mingo@elte.hu,
	paulus@samba.org, linux-kernel@vger.kernel.org,
	rostedt@goodmis.org, nhorman@tuxdriver.com,
	eric.dumazet@gmail.com
Subject: Re: [PATCHv3 1/2] perf tools: Fix raw sample reading
Date: Thu, 29 Sep 2011 09:34:32 -0600	[thread overview]
Message-ID: <4E849008.8080403@gmail.com> (raw)
In-Reply-To: <1317308709-9474-2-git-send-email-jolsa@redhat.com>



On 09/29/2011 09:05 AM, Jiri Olsa wrote:
> 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.
> 
> CC: David Ahern <dsahern@gmail.com>
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> ---
>  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 c5748c5..e389815 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,
>  	}
>  
>  	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;

Oops. Thanks for fixing.

Reviewed-by: David Ahern <dsahern@gmail.com>

  reply	other threads:[~2011-09-29 15:34 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22 14:23 [PATCH] perf, tool, record: Fix the header generation for pipe Jiri Olsa
2011-08-22 14:38 ` Eric Dumazet
2011-08-22 14:52   ` Jiri Olsa
2011-08-22 15:51     ` Eric Dumazet
2011-08-22 16:07       ` Jiri Olsa
2011-08-29 13:20         ` Arnaldo Carvalho de Melo
2011-08-29 13:41           ` Jiri Olsa
2011-08-29 14:25             ` Arnaldo Carvalho de Melo
2011-09-14 13:58               ` [PATCH] perf tools: Fix tracing info recording Jiri Olsa
2011-09-14 15:44                 ` Neil Horman
2011-09-21 15:30                 ` Frederic Weisbecker
2011-09-25 13:34                   ` Jiri Olsa
2011-09-26  9:11                     ` [PATCHv2 1/2] " Jiri Olsa
2011-09-26  9:11                       ` [PATCHv2 1/2] perf tools: Collect tracing event data files directly Jiri Olsa
2011-09-26 13:36                         ` Steven Rostedt
2011-09-26 14:56                           ` Jiri Olsa
2011-09-28 13:55                             ` Frederic Weisbecker
2011-09-28 14:03                               ` Steven Rostedt
2011-09-28 14:17                                 ` Frederic Weisbecker
2011-09-28 14:23                                   ` Steven Rostedt
2011-09-28 16:56                                   ` Ingo Molnar
2011-09-28 17:10                                     ` Steven Rostedt
2011-10-10  5:22                                       ` Ingo Molnar
2011-10-10 12:27                                         ` Steven Rostedt
2011-10-10 14:21                                           ` Frederic Weisbecker
2011-09-26 13:43                         ` David Ahern
2011-09-26 14:58                           ` Jiri Olsa
2011-09-26  9:11                       ` [PATCHv2 2/2] perf tools: Fix tracing info recording Jiri Olsa
2011-09-29 15:05                       ` [PATCHv3 0/2] " Jiri Olsa
2011-09-29 15:05                         ` [PATCHv3 1/2] perf tools: Fix raw sample reading Jiri Olsa
2011-09-29 15:34                           ` David Ahern [this message]
2011-09-29 15:05                         ` [PATCHv3 2/2] perf tools: Fix tracing info recording Jiri Olsa
2011-10-13 14:00                           ` Jiri Olsa
2011-10-20 13:59                             ` [PATCHv4] " Jiri Olsa
2011-10-20 21:28                               ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E849008.8080403@gmail.com \
    --to=dsahern@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nhorman@tuxdriver.com \
    --cc=paulus@samba.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).