All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	Paul Mackerras <paulus@samba.org>,
	OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/3] perf/sched: fix 'perf sched trace'
Date: Mon, 07 Dec 2009 12:04:49 +0800	[thread overview]
Message-ID: <4B1C7EE1.8030906@cn.fujitsu.com> (raw)

If we use 'perf sched trace', it will call symbol__init() again,
and can lead perf tool crash:

[root@localhost perf]# ./perf sched trace
*** glibc detected *** ./perf: free(): invalid next size (normal): 0x094c1898 ***
======= Backtrace: =========
/lib/libc.so.6[0xb7602404]
/lib/libc.so.6(cfree+0x96)[0xb76043b6]
./perf[0x80730fe]
./perf[0x8074c97]
./perf[0x805eb59]
./perf[0x80536fd]
./perf[0x804b618]
./perf[0x804bdc3]
/lib/libc.so.6(__libc_start_main+0xe5)[0xb75a9735]
./perf[0x804af81]
======= Memory map: ========
08048000-08158000 r-xp 00000000 fe:00 556831     /home/eric/....
08158000-08168000 rw-p 0010f000 fe:00 556831     /home/eric/...
08168000-085fe000 rw-p 00000000 00:00 0
094ab000-094cc000 rw-p 00000000 00:00 0          [heap]

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
---
 tools/perf/builtin-sched.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 45c46c7..7481ebd 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1888,13 +1888,18 @@ static int __cmd_record(int argc, const char **argv)
 
 int cmd_sched(int argc, const char **argv, const char *prefix __used)
 {
-	symbol__init(0);
-
 	argc = parse_options(argc, argv, sched_options, sched_usage,
 			     PARSE_OPT_STOP_AT_NON_OPTION);
 	if (!argc)
 		usage_with_options(sched_usage, sched_options);
 
+	/*
+	 * Aliased to 'perf trace' for now:
+	 */
+	if (!strcmp(argv[0], "trace"))
+		return cmd_trace(argc, argv, prefix);
+
+	symbol__init(0);
 	if (!strncmp(argv[0], "rec", 3)) {
 		return __cmd_record(argc, argv);
 	} else if (!strncmp(argv[0], "lat", 3)) {
@@ -1918,11 +1923,6 @@ int cmd_sched(int argc, const char **argv, const char *prefix __used)
 				usage_with_options(replay_usage, replay_options);
 		}
 		__cmd_replay();
-	} else if (!strcmp(argv[0], "trace")) {
-		/*
-		 * Aliased to 'perf trace' for now:
-		 */
-		return cmd_trace(argc, argv, prefix);
 	} else {
 		usage_with_options(sched_usage, sched_options);
 	}
-- 
1.6.1.2


             reply	other threads:[~2009-12-07  4:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-07  4:04 Xiao Guangrong [this message]
2009-12-07  4:06 ` [PATCH 2/3] perf_event: fix for procing raw event Xiao Guangrong
2009-12-07  4:07   ` [PATCH 3/3] perf_event: fix __dsos__write_buildid_table() Xiao Guangrong
2009-12-07  5:19     ` OGAWA Hirofumi
2009-12-07  5:31     ` [tip:perf/urgent] perf_event: Fix __dsos__write_buildid_table() tip-bot for Xiao Guangrong
2009-12-07  4:54   ` [PATCH 2/3] perf_event: fix for procing raw event Xiao Guangrong
2009-12-07  5:04   ` [PATCH] perf_event: fix for processing raw event - fix Xiao Guangrong
2009-12-07  5:31     ` [tip:perf/urgent] perf_event: Eliminate raw->size tip-bot for Xiao Guangrong
2009-12-07  8:13       ` Peter Zijlstra
2009-12-07  8:30         ` Xiao Guangrong
2009-12-07  8:46           ` OGAWA Hirofumi
2009-12-07  6:33     ` [PATCH] perf_event: fix for processing raw event - fix OGAWA Hirofumi
2009-12-07  6:35       ` OGAWA Hirofumi
2009-12-07  5:31   ` [tip:perf/urgent] perf_event: Fix raw event processing tip-bot for Xiao Guangrong
2009-12-07  5:30 ` [tip:perf/urgent] perf/sched: Fix 'perf sched trace' tip-bot for Xiao Guangrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B1C7EE1.8030906@cn.fujitsu.com \
    --to=xiaoguangrong@cn.fujitsu.com \
    --cc=fweisbec@gmail.com \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.