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] [day] [month] [year] [list]
Date:   Mon, 24 Apr 2017 14:17:43 -0700
From:   tip-bot for Jiri Olsa <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     acme@...hat.com, linux-kernel@...r.kernel.org, hpa@...or.com,
        jolsa@...nel.org, dsahern@...il.com, tglx@...utronix.de,
        a.p.zijlstra@...llo.nl, mingo@...nel.org, namhyung@...nel.org,
        treeze.taeung@...il.com, yao.jin@...ux.intel.com
Subject: [tip:perf/core] perf tools: Fix the code to strip command name

Commit-ID:  9d43f5e8df6804ae271407500af9062e9278167a
Gitweb:     http://git.kernel.org/tip/9d43f5e8df6804ae271407500af9062e9278167a
Author:     Jiri Olsa <jolsa@...nel.org>
AuthorDate: Thu, 20 Apr 2017 11:24:30 +0200
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Mon, 24 Apr 2017 13:43:37 -0300

perf tools: Fix the code to strip command name

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.

Keeping the ltrim, but moving back the left to right '\n' search
instead of the rtrim.

Signed-off-by: Jiri Olsa <jolsa@...nel.org>
Acked-by: Taeung Song <treeze.taeung@...il.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Yao Jin <yao.jin@...ux.intel.com>
Fixes: bdd97ca63faa ("perf tools: Refactor the code to strip command name with {l,r}trim()")
Link: http://lkml.kernel.org/r/20170420092430.29657-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 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 2e829ac..142835c 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -141,8 +141,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