lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E849008.8080403@gmail.com>
Date:	Thu, 29 Sep 2011 09:34:32 -0600
From:	David Ahern <dsahern@...il.com>
To:	Jiri Olsa <jolsa@...hat.com>
CC:	acme@...hat.com, a.p.zijlstra@...llo.nl, mingo@...e.hu,
	paulus@...ba.org, linux-kernel@...r.kernel.org,
	rostedt@...dmis.org, nhorman@...driver.com, eric.dumazet@...il.com
Subject: Re: [PATCHv3 1/2] perf tools: Fix raw sample reading



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@...il.com>
> Signed-off-by: Jiri Olsa <jolsa@...hat.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@...il.com>
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ