linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, He Kuang <hekuang@huawei.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Wang Nan <wangnan0@huawei.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 5/5] perf probe: Fix segfault when probe with lazy_line to file
Date: Mon, 13 Apr 2015 19:15:02 -0300	[thread overview]
Message-ID: <1428963302-31538-6-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1428963302-31538-1-git-send-email-acme@kernel.org>

From: He Kuang <hekuang@huawei.com>

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 <hekuang@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1428925290-5623-3-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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 431c12d299a2..e91101b8f60f 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1067,7 +1067,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);
-- 
1.9.3


  parent reply	other threads:[~2015-04-13 22:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 22:14 [GIT PULL 0/5] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-04-13 22:14 ` [PATCH 1/5] tracing, mm: Record pfn instead of pointer to struct page Arnaldo Carvalho de Melo
2017-07-31  7:43   ` Vlastimil Babka
2017-08-31 11:38     ` Vlastimil Babka
2017-08-31 13:43     ` Steven Rostedt
2017-08-31 14:31       ` Vlastimil Babka
2017-08-31 14:44         ` Steven Rostedt
2017-09-01  8:16           ` Vlastimil Babka
2017-09-01 11:15             ` Steven Rostedt
2015-04-13 22:14 ` [PATCH 2/5] perf kmem: Analyze page allocator events also Arnaldo Carvalho de Melo
2015-04-13 22:15 ` [PATCH 3/5] perf probe: Set retprobe flag when probe in address-based alternative mode Arnaldo Carvalho de Melo
2015-04-13 22:15 ` [PATCH 4/5] perf probe: Make --source avaiable when probe with lazy_line Arnaldo Carvalho de Melo
2015-04-13 22:15 ` Arnaldo Carvalho de Melo [this message]
2015-04-13 22:33 ` [GIT PULL 0/5] perf/core improvements and fixes Masami Hiramatsu
2015-04-13 23:09   ` Arnaldo Carvalho de Melo
2015-04-13 23:19     ` Arnaldo Carvalho de Melo
2015-04-14  7:04       ` Masami Hiramatsu
2015-04-14 12:17         ` Arnaldo Carvalho de Melo
2015-04-14 12:12       ` Ingo Molnar

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=1428963302-31538-6-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=hekuang@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=wangnan0@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).