Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932100AbbDNMSl (ORCPT ); Tue, 14 Apr 2015 08:18:41 -0400 Received: from terminus.zytor.com ([198.137.202.10]:38302 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755341AbbDNMSY (ORCPT ); Tue, 14 Apr 2015 08:18:24 -0400 Date: Tue, 14 Apr 2015 05:18:04 -0700 From: tip-bot for He Kuang Message-ID: Cc: mingo@kernel.org, acme@redhat.com, namhyung@kernel.org, a.p.zijlstra@chello.nl, linux-kernel@vger.kernel.org, tglx@linutronix.de, wangnan0@huawei.com, masami.hiramatsu.pt@hitachi.com, hpa@zytor.com, hekuang@huawei.com Reply-To: linux-kernel@vger.kernel.org, tglx@linutronix.de, a.p.zijlstra@chello.nl, namhyung@kernel.org, mingo@kernel.org, acme@redhat.com, hekuang@huawei.com, hpa@zytor.com, masami.hiramatsu.pt@hitachi.com, wangnan0@huawei.com In-Reply-To: <1428925290-5623-3-git-send-email-hekuang@huawei.com> References: <1428925290-5623-3-git-send-email-hekuang@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf probe: Fix segfault when probe with lazy_line to file Git-Commit-ID: f19e80c640d58ddfd70f2454ee597f81ba966690 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2401 Lines: 60 Commit-ID: f19e80c640d58ddfd70f2454ee597f81ba966690 Gitweb: http://git.kernel.org/tip/f19e80c640d58ddfd70f2454ee597f81ba966690 Author: He Kuang AuthorDate: Mon, 13 Apr 2015 19:41:30 +0800 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 13 Apr 2015 20:12:21 -0300 perf probe: Fix segfault when probe with lazy_line to file The first argument passed to find_probe_point_lazy() should be CU die, which will be passed to die_walk_lines() when lazy_line matches. Currently, when we probe with lazy_line pattern to file without function name, NULL pointer is passed and causes a segment fault. Can be reproduced as following: $ perf probe -k vmlinux --add='fs/super.c;s->s_count=1;' [ 1958.984658] perf[1020]: segfault at 10 ip 00007fc6e10d8c71 sp 00007ffcbfaaf900 error 4 in libdw-0.161.so[7fc6e10ce000+34000] Segmentation fault After this patch: $ perf probe -k vmlinux --add='fs/super.c;s->s_count=1;' Added new event: probe:_stext (on @fs/super.c) You can now use it in all perf tools, such as: perf record -e probe:_stext -aR sleep 1 Signed-off-by: He Kuang Tested-by: Arnaldo Carvalho de Melo Acked-by: Masami Hiramatsu Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/r/1428925290-5623-3-git-send-email-hekuang@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/probe-finder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index ff7865c..44554c3 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -1066,7 +1066,7 @@ static int debuginfo__find_probes(struct debuginfo *dbg, if (pp->function) ret = find_probe_point_by_func(pf); else if (pp->lazy_line) - ret = find_probe_point_lazy(NULL, pf); + ret = find_probe_point_lazy(&pf->cu_die, pf); else { pf->lno = pp->line; ret = find_probe_point_by_line(pf); -- 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/