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]
Date:	Fri, 25 Jul 2014 10:15:21 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Ingo Molnar <mingo@...nel.org>,
	Paul Mackerras <paulus@...ba.org>,
	Namhyung Kim <namhyung.kim@....com>,
	LKML <linux-kernel@...r.kernel.org>,
	Jiri Olsa <jolsa@...hat.com>, David Ahern <dsahern@...il.com>,
	Minchan Kim <minchan@...nel.org>
Subject: Re: [PATCH 1/2] perf tools: Ensure --symfs ends with '/'

Em Fri, Jul 25, 2014 at 10:31:47AM +0900, Namhyung Kim escreveu:
> Minchan reported that perf failed to load vmlinux if --symfs argument
> doesn't end with '/' character.  So make sure that the symfs always
> ends with the '/'.

I don't think this is the right way of doing this, users of
symbol_conf.symfs should instead make sure that they do what they expect
to, i.e. if they want it to be a base directory, make sure that a path
separator is added between it and the relative path following it, if
not, do as they please.

- Arnaldo
 
> Reported-by: Minchan Kim <minchan@...nel.org>
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> ---
>  tools/perf/util/symbol.c | 41 +++++++++++++++++++++++++++++------------
>  1 file changed, 29 insertions(+), 12 deletions(-)
> 
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index eb06746b06b2..90723a12e947 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -1829,7 +1829,7 @@ static bool symbol__read_kptr_restrict(void)
>  
>  int symbol__init(void)
>  {
> -	const char *symfs;
> +	char *symfs;
>  
>  	if (symbol_conf.initialized)
>  		return 0;
> @@ -1862,23 +1862,40 @@ int symbol__init(void)
>  		       symbol_conf.sym_list_str, "symbol") < 0)
>  		goto out_free_comm_list;
>  
> -	/*
> -	 * A path to symbols of "/" is identical to ""
> -	 * reset here for simplicity.
> -	 */
> -	symfs = realpath(symbol_conf.symfs, NULL);
> -	if (symfs == NULL)
> -		symfs = symbol_conf.symfs;
> -	if (strcmp(symfs, "/") == 0)
> -		symbol_conf.symfs = "";
> -	if (symfs != symbol_conf.symfs)
> -		free((void *)symfs);
> +	if (*symbol_conf.symfs) {
> +		symfs = realpath(symbol_conf.symfs, NULL);
> +		if (symfs == NULL)
> +			symfs = (char *)symbol_conf.symfs;
> +
> +		/*
> +		 * A path to symbols of "/" is identical to ""
> +		 * reset here for simplicity.
> +		 */
> +		if (strcmp(symfs, "/") == 0)
> +			symbol_conf.symfs = "";
> +
> +		/* ensure symfs ends with '/' */
> +		if (symfs[strlen(symfs)-1] != '/') {
> +			char *tmp = realloc(symfs, strlen(symfs) + 2);
> +			if (tmp == NULL)
> +				goto out_free;
> +
> +			tmp[strlen(tmp)+1] = '\0';
> +			tmp[strlen(tmp)] = '/';
> +
> +			symbol_conf.symfs = tmp;
> +		} else {
> +			free(symfs);
> +		}
> +	}
>  
>  	symbol_conf.kptr_restrict = symbol__read_kptr_restrict();
>  
>  	symbol_conf.initialized = true;
>  	return 0;
>  
> +out_free:
> +	free(symfs);
>  out_free_comm_list:
>  	strlist__delete(symbol_conf.comm_list);
>  out_free_dso_list:
> -- 
> 2.0.0
--
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