Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752530AbbDCK5a (ORCPT ); Fri, 3 Apr 2015 06:57:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36062 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751668AbbDCK52 (ORCPT ); Fri, 3 Apr 2015 06:57:28 -0400 Date: Fri, 3 Apr 2015 12:57:21 +0200 From: Jiri Olsa To: Wang Nan Cc: namhyung@kernel.org, jolsa@kernel.org, acme@redhat.com, mingo@kernel.org, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [PATCH v2] perf: report/annotate: fix segfault problem. Message-ID: <20150403105721.GB5571@krava.brq.redhat.com> References: <1428040585-52586-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1428040585-52586-1-git-send-email-wangnan0@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2029 Lines: 67 On Fri, Apr 03, 2015 at 05:56:25AM +0000, Wang Nan wrote: > perf report and perf annotate are easy to trigger segfault if trace data > contain kernel module information like this: > > # perf report -D -i ./perf.data > ... > 0 0 0x188 [0x50]: PERF_RECORD_MMAP -1/0: [0xffffffbff1018000(0xf068000) @ 0]: x [test_module] oops, I was wondering how you'd get such a MMAP record, because we lookup modules real paths and store it.. I haven't realized that if we dont find it we keep the '[mod]' name :-\ SNIP > Signed-off-by: Wang Nan > --- > > Patch v1 doesn't consider module named as [aaa.bbb]. > > --- > tools/perf/util/dso.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c > index fc0ddd5..08d7aaf 100644 > --- a/tools/perf/util/dso.c > +++ b/tools/perf/util/dso.c > @@ -214,12 +214,23 @@ int __kmod_path__parse(struct kmod_path *m, const char *path, > { > const char *name = strrchr(path, '/'); > const char *ext = strrchr(path, '.'); > + bool is_simple_name = false; > > memset(m, 0x0, sizeof(*m)); > name = name ? name + 1 : path; > > + /* > + * '.' is also a valid character. For example: [aaa.bbb] is a > + * valid module name. '[' should have higher priority than > + * '.ko' suffix. > + */ > + if ((name[0] == '[') && (strncmp(name, "[vdso]", 6) != 0)) { maybe also check for '[vsyscall]' ? > + m->kmod = true; > + is_simple_name = true; > + } > + > /* No extension, just return name. */ > - if (ext == NULL) { > + if ((ext == NULL) || is_simple_name) { > if (alloc_name) { > m->name = strdup(name); > return m->name ? 0 : -ENOMEM; otherwise it looks ok to me.. please update also the tests/kmod-path.c ;-) thanks, jirka -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/