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:   Thu, 20 Apr 2017 19:17:34 +0900
From:   Taeung Song <treeze.taeung@...il.com>
To:     Jiri Olsa <jolsa@...nel.org>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        David Ahern <dsahern@...il.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Jin Yao <yao.jin@...ux.intel.com>,
        lkml <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH perf/urgent] perf tools: Fix the code to strip command
 name

Hi Jiri,

On 04/20/2017 06:24 PM, Jiri Olsa wrote:
> Recent commit broke command name strip in perf_event__get_comm_ids
> function. It replaced left to right search for '\n' with rtrim,
> which actually does right to left search. It occasionally caught
> earlier '\n' and kept trash in the command name.

Sorry for my commit that have failings.

Could I know the command name in the above case ?
The command name can have two '\n' ?


Thanks,
Taeung

>
> Keeping the ltrim, but moving back the left to right '\n' search
> instead of the rtrim.
>
> Fixes: bdd97ca63faa ("perf tools: Refactor the code to strip command name with {l,r}trim()")
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> Cc: David Ahern <dsahern@...il.com>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> Cc: Taeung Song <treeze.taeung@...il.com>
> Cc: Jin Yao <yao.jin@...ux.intel.com>
> Link: http://lkml.kernel.org/n/tip-51mt8hxaig74zlu42s3rv0i7@git.kernel.org
> ---
>  tools/perf/util/event.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
> index cf457ef534da..1a9164a816d9 100644
> --- a/tools/perf/util/event.c
> +++ b/tools/perf/util/event.c
> @@ -138,8 +138,15 @@ static int perf_event__get_comm_ids(pid_t pid, char *comm, size_t len,
>  	ppids = strstr(bf, "PPid:");
>
>  	if (name) {
> +		char *nl;
> +
>  		name += 5;  /* strlen("Name:") */
> -		name = rtrim(ltrim(name));
> +		name = ltrim(name);
> +
> +		nl = strchr(name, '\n');
> +		if (nl)
> +			*nl = '\0';
> +
>  		size = strlen(name);
>  		if (size >= len)
>  			size = len - 1;
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ