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: <0d08c9db-1715-c8b8-950d-9034760499b4@us.ibm.com>
Date:   Thu, 11 May 2017 08:13:24 -0500
From:   Paul Clarke <pc@...ibm.com>
To:     Milian Wolff <milian.wolff@...b.com>, Linux-kernel@...r.kernel.org
Cc:     linux-perf-users@...r.kernel.org,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        David Ahern <dsahern@...il.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Yao Jin <yao.jin@...ux.intel.com>
Subject: Re: [PATCH] perf report: don't crash on invalid maps in `-g srcline`
 mode

On 05/09/2017 03:50 PM, Milian Wolff wrote:
> diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
> index 9ab68682c6d0..295f0846fd84 100644
> --- a/tools/perf/util/callchain.c
> +++ b/tools/perf/util/callchain.c
> @@ -642,13 +642,22 @@ static enum match_result match_chain_strings(const char *left,
>  static enum match_result match_chain_srcline(struct callchain_cursor_node *node,
>  					     struct callchain_list *cnode)
>  {
> -	char *left = get_srcline(cnode->ms.map->dso,
> -				 map__rip_2objdump(cnode->ms.map, cnode->ip),
> -				 cnode->ms.sym, true, false);
> -	char *right = get_srcline(node->map->dso,
> -				  map__rip_2objdump(node->map, node->ip),
> -				  node->sym, true, false);
> -	enum match_result ret = match_chain_strings(left, right);
> +	char *left = NULL;
> +	char *right = NULL;

nit: the above two initializations are unnecessary.

> +	enum match_result ret = MATCH_ERROR;
> +
> +	if (!node->map || !cnode->ms.map)
> +		return ret;
> +
> +	left = get_srcline(cnode->ms.map->dso,
> +			   map__rip_2objdump(cnode->ms.map, cnode->ip),
> +			   cnode->ms.sym, true, false);
> +
> +	right = get_srcline(node->map->dso,
> +			    map__rip_2objdump(node->map, node->ip),
> +			    node->sym, true, false);
> +
> +	ret = match_chain_strings(left, right);
> 
>  	free_srcline(left);
>  	free_srcline(right);

PC

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ