From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Namhyung Kim <namhyung@gmail.com>
Cc: linux-kernel@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@redhat.com>, Ingo Molnar <mingo@redhat.com>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH -tip/urgent ] [BUGFIX] perf/probe: Fix a segfault if asked for variable it doesn't find
Date: Fri, 30 May 2014 15:32:26 +0900 [thread overview]
Message-ID: <538825FA.90407@hitachi.com> (raw)
In-Reply-To: <874n07g5wo.fsf@sejong.aot.lge.com>
(2014/05/30 15:03), Namhyung Kim wrote:
> Hi Masami,
>
> On Thu, 29 May 2014 19:52:32 +0900, Masami Hiramatsu wrote:
>> Fix a segfault bug by asking for variable it doesn't find.
>> Since the convert_variable() didn't handle error code returned
>> from convert_variable_location(), it just passed an incomplete
>> variable field and then a segfault was occured when formatting
>> the field.
>>
>> This fixes that bug by handling success code correctly in
>> convert_variable(). Other callers of convert_variable_location()
>> are correctly checking the return code.
>>
>> This bug was introduced by following commit. But another hidden
>> erroneous error handling has been there previuosly (-ENOMEM case).
>
> And -ERANGE too.. :)
Right, Anyway, I've added ret==0 sanity check. That error should be
handled too. :-)
Thank you,
>
> Thanks,
> Namhyung
>
>>
>> commit 3d918a12a1b3088ac16ff37fa52760639d6e2403
>>
>> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
>> Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
>> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
>> Cc: Paul Mackerras <paulus@samba.org>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: Namhyung Kim <namhyung@kernel.org>
>> Cc: Jiri Olsa <jolsa@redhat.com>
>> ---
>> tools/perf/util/probe-finder.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
>> index 5627621..9d8eb26 100644
>> --- a/tools/perf/util/probe-finder.c
>> +++ b/tools/perf/util/probe-finder.c
>> @@ -511,12 +511,12 @@ static int convert_variable(Dwarf_Die *vr_die, struct probe_finder *pf)
>>
>> ret = convert_variable_location(vr_die, pf->addr, pf->fb_ops,
>> &pf->sp_die, pf->tvar);
>> - if (ret == -ENOENT)
>> + if (ret == -ENOENT || ret == -EINVAL)
>> pr_err("Failed to find the location of %s at this address.\n"
>> " Perhaps, it has been optimized out.\n", pf->pvar->var);
>> else if (ret == -ENOTSUP)
>> pr_err("Sorry, we don't support this variable location yet.\n");
>> - else if (pf->pvar->field) {
>> + else if (ret == 0 && pf->pvar->field) {
>> ret = convert_variable_fields(vr_die, pf->pvar->var,
>> pf->pvar->field, &pf->tvar->ref,
>> &die_mem);
>
--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
next prev parent reply other threads:[~2014-05-30 6:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-28 21:44 [BUG] perf probe segfaulting when asked for variable it doesn't find Arnaldo Carvalho de Melo
2014-05-29 9:56 ` Masami Hiramatsu
2014-05-29 10:52 ` [PATCH -tip/urgent ] [BUGFIX] perf/probe: Fix a segfault if " Masami Hiramatsu
2014-05-29 11:03 ` Masami Hiramatsu
2014-05-29 12:19 ` [PATCH -tip ] [BUGFIX] perf/probe: Fix perf probe to find correct variable DIE Masami Hiramatsu
2014-05-29 12:39 ` Masami Hiramatsu
2014-05-29 13:41 ` Jiri Olsa
2014-06-03 18:29 ` Ingo Molnar
2014-05-29 13:56 ` Arnaldo Carvalho de Melo
2014-06-03 20:38 ` Arnaldo Carvalho de Melo
2014-06-04 8:25 ` Masami Hiramatsu
2014-06-04 11:31 ` Jiri Olsa
2014-06-04 12:19 ` Masami Hiramatsu
2014-06-04 12:22 ` Jiri Olsa
2014-06-03 18:56 ` Arnaldo Carvalho de Melo
2014-06-05 8:15 ` [tip:perf/urgent] perf probe: " tip-bot for Masami Hiramatsu
2014-05-30 6:03 ` [PATCH -tip/urgent ] [BUGFIX] perf/probe: Fix a segfault if asked for variable it doesn't find Namhyung Kim
2014-05-30 6:32 ` Masami Hiramatsu [this message]
2014-06-05 8:15 ` [tip:perf/urgent] perf probe: " tip-bot for Masami Hiramatsu
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=538825FA.90407@hitachi.com \
--to=masami.hiramatsu.pt@hitachi.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@gmail.com \
--cc=paulus@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox