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: <tip-deab6f55a2fe6fe044af61c9aad6a8e90cda6499@git.kernel.org>
Date:	Tue, 24 Mar 2015 09:33:10 -0700
From:	tip-bot for Josef Bacik <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	namhyung@...nel.org, acme@...hat.com, mingo@...nel.org,
	jolsa@...hat.com, linux-kernel@...r.kernel.org, jbacik@...com,
	akpm@...ux-foundation.org, rostedt@...dmis.org, hpa@...or.com,
	tglx@...utronix.de
Subject: [tip:perf/core] tools lib traceevent: Handle NULL comm name

Commit-ID:  deab6f55a2fe6fe044af61c9aad6a8e90cda6499
Gitweb:     http://git.kernel.org/tip/deab6f55a2fe6fe044af61c9aad6a8e90cda6499
Author:     Josef Bacik <jbacik@...com>
AuthorDate: Tue, 24 Mar 2015 09:57:49 -0400
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 24 Mar 2015 12:10:26 -0300

tools lib traceevent: Handle NULL comm name

It is possible that a pid has no associated comm attached to it, although it
can still be passed to pevent_register_comm().

But if comm is NULL, it will cause strdup() to segfault. To prevent this
from happening, if comm is NULL use the default "<...>" name for the
pid.

Signed-off-by: Josef Bacik <jbacik@...com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Link: http://lkml.kernel.org/r/20150324135922.549965495@goodmis.org
Link: http://lkml.kernel.org/p/1403799732-30308-1-git-send-email-jbacik@fb.com
Signed-off-by: Steven Rostedt <rostedt@...dmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/lib/traceevent/event-parse.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 8e5e4f6..31d4e7d 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -304,7 +304,10 @@ int pevent_register_comm(struct pevent *pevent, const char *comm, int pid)
 	if (!item)
 		return -1;
 
-	item->comm = strdup(comm);
+	if (comm)
+		item->comm = strdup(comm);
+	else
+		item->comm = strdup("<...>");
 	if (!item->comm) {
 		free(item);
 		return -1;
--
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