public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: He Kuang <hekuang@huawei.com>
Cc: acme@kernel.org, a.p.zijlstra@chello.nl, mingo@redhat.com,
	namhyung@kernel.org, wangnan0@huawei.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] perf probe: Fix segfault when probe with lazy_line to file
Date: Tue, 14 Apr 2015 01:03:55 +0900	[thread overview]
Message-ID: <552BE8EB.2000502@hitachi.com> (raw)
In-Reply-To: <1428925290-5623-3-git-send-email-hekuang@huawei.com>

(2015/04/13 20:41), He Kuang wrote:
> 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 repoduced 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
> 

Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

Thanks!

> Signed-off-by: He Kuang <hekuang@huawei.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 431c12d..e91101b 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);
> 


-- 
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering
Hitachi, Ltd., Research & Development Group
E-mail: masami.hiramatsu.pt@hitachi.com



  reply	other threads:[~2015-04-13 16:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 11:41 [PATCH 1/3] perf probe: Set retprobe flag when probe in address-based alternative mode He Kuang
2015-04-13 11:41 ` [PATCH 2/3] perf probe: Make --source avaiable when probe with lazy_line He Kuang
2015-04-13 15:41   ` Masami Hiramatsu
2015-04-13 16:05     ` Arnaldo Carvalho de Melo
2015-04-13 20:56   ` Arnaldo Carvalho de Melo
2015-04-13 20:57     ` Arnaldo Carvalho de Melo
2015-04-13 21:00       ` Arnaldo Carvalho de Melo
2015-04-13 11:41 ` [PATCH 3/3] perf probe: Fix segfault when probe with lazy_line to file He Kuang
2015-04-13 16:03   ` Masami Hiramatsu [this message]
2015-04-14 12:18   ` [tip:perf/urgent] " tip-bot for He Kuang
2015-04-13 14:39 ` [PATCH 1/3] perf probe: Set retprobe flag when probe in address-based alternative mode Arnaldo Carvalho de Melo
2015-04-13 14:42   ` Arnaldo Carvalho de Melo
2015-04-13 15:38     ` He Kuang
2015-04-13 20:42       ` Arnaldo Carvalho de Melo
2015-04-13 15:23   ` He Kuang
2015-04-13 16:23     ` Arnaldo Carvalho de Melo
2015-04-13 15:42 ` Masami Hiramatsu
2015-04-13 16:05   ` Arnaldo Carvalho de Melo
2015-04-14 12:17 ` [tip:perf/urgent] " tip-bot for He Kuang

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=552BE8EB.2000502@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=hekuang@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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