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: <87ppgnhge3.fsf@sejong.aot.lge.com>
Date:	Wed, 30 Jul 2014 08:52:36 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:	Minchan Kim <minchan@...nel.org>,
	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>
Subject: Re: [PATCH 1/2] perf tools: Ensure --symfs ends with '/'

Hi Arnaldo,

On Tue, 29 Jul 2014 09:33:05 -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Jul 29, 2014 at 02:02:46PM +0900, Minchan Kim escreveu:
>> On Fri, Jul 25, 2014 at 10:31:47AM +0900, Namhyung Kim wrote:
>> > 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 '/'.
>> > 
>> > Reported-by: Minchan Kim <minchan@...nel.org>
>> > Signed-off-by: Namhyung Kim <namhyung@...nel.org>
>> 
>> Both patches work and are handy to me.
>> Thanks Namhyung.
>
> I haven't said it is not :-) Just that it should be fixed in a different
> way.

I also thought about that way first but changed my mind to the current
approach because I don't want to change current behavior.

I worried about the common case which has empty symfs.  By your patch,
it makes a pathname absolute even with an empty symfs - I can see most
filenames are already absolute paths but I'm not 100% sure it's always
the case.

Thanks,
Namhyung


>
> Can you please try the patch below instead?
>
> David, was there any reason not to do it like done in this patch?
>
> - Arnaldo
>
> ---
>  annotate.c |    4 ++--
>  dso.c      |    8 ++++----
>  symbol.c   |    2 +-
>  3 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> index 809b4c50beae..e67ef4a2b356 100644
> --- a/tools/perf/util/annotate.c
> +++ b/tools/perf/util/annotate.c
> @@ -900,7 +900,7 @@ int symbol__annotate(struct symbol *sym, struct map *map, size_t privsize)
>  	bool delete_extract = false;
>  
>  	if (filename) {
> -		snprintf(symfs_filename, sizeof(symfs_filename), "%s%s",
> +		snprintf(symfs_filename, sizeof(symfs_filename), "%s/%s",
>  			 symbol_conf.symfs, filename);
>  	}
>  
> @@ -922,7 +922,7 @@ fallback:
>  		 * DSO is the same as when 'perf record' ran.
>  		 */
>  		filename = (char *)dso->long_name;
> -		snprintf(symfs_filename, sizeof(symfs_filename), "%s%s",
> +		snprintf(symfs_filename, sizeof(symfs_filename), "%s/%s",
>  			 symbol_conf.symfs, filename);
>  		free_filename = false;
>  	}
> diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
> index 90d02c661dd4..f81550583429 100644
> --- a/tools/perf/util/dso.c
> +++ b/tools/perf/util/dso.c
> @@ -79,7 +79,7 @@ int dso__read_binary_type_filename(const struct dso *dso,
>  		while (last_slash != dso->long_name && *last_slash != '/')
>  			last_slash--;
>  
> -		len = scnprintf(filename, size, "%s", symbol_conf.symfs);
> +		len = scnprintf(filename, size, "%s/", symbol_conf.symfs);
>  		dir_size = last_slash - dso->long_name + 2;
>  		if (dir_size > (size - len)) {
>  			ret = -1;
> @@ -108,17 +108,17 @@ int dso__read_binary_type_filename(const struct dso *dso,
>  	case DSO_BINARY_TYPE__VMLINUX:
>  	case DSO_BINARY_TYPE__GUEST_VMLINUX:
>  	case DSO_BINARY_TYPE__SYSTEM_PATH_DSO:
> -		snprintf(filename, size, "%s%s",
> +		snprintf(filename, size, "%s/%s",
>  			 symbol_conf.symfs, dso->long_name);
>  		break;
>  
>  	case DSO_BINARY_TYPE__GUEST_KMODULE:
> -		snprintf(filename, size, "%s%s%s", symbol_conf.symfs,
> +		snprintf(filename, size, "%s/%s/%s", symbol_conf.symfs,
>  			 root_dir, dso->long_name);
>  		break;
>  
>  	case DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE:
> -		snprintf(filename, size, "%s%s", symbol_conf.symfs,
> +		snprintf(filename, size, "%s/%s", symbol_conf.symfs,
>  			 dso->long_name);
>  		break;
>  
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index eb06746b06b2..c3549d5955ea 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -1468,7 +1468,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
>  	if (vmlinux[0] == '/')
>  		snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s", vmlinux);
>  	else
> -		snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s%s",
> +		snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s/%s",
>  			 symbol_conf.symfs, vmlinux);
>  
>  	if (dso->kernel == DSO_TYPE_GUEST_KERNEL)
--
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