From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: Frederik Deweerdt <frederik.deweerdt@xprog.eu>
Cc: namhyung@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [patch] perf: tui: Fix segfault when drawing out-of-bounds jumps
Date: Mon, 14 Jan 2013 10:44:16 -0300 [thread overview]
Message-ID: <20130114134416.GA8768@infradead.org> (raw)
In-Reply-To: <20130112000043.GC32415@ks398093.ip-192-95-24.net>
Em Fri, Jan 11, 2013 at 07:00:43PM -0500, Frederik Deweerdt escreveu:
> Hi,
>
> When perf.data contains out-of-symbol jumps,
> annotate_browser__mark_jump_targets() correctly avoids marking
> out-of-symbol jump targets. However, when moving the cursor on one of
> said jumps, annotate_browser__draw_current_jump() will end up with a
> bogus 'target' pointer, causing a bogus memory access when dereferencing
> 'bcursor' or 'btarget'
>
> The following patch performs the same check as mark_jump_targets()
> in order to avoid drawing the bogus jump.
Thanks, I'll apply this one later today and introduce a
disasm_line__is_valid_jump(cursor) routine to be used in both mark and
draw routines, if you don't do it first :-)
- Arnaldo
> Regards,
> Frederik
>
> Signed-off-by: Frederik Deweerdt <frederik.deweerdt@xprog.eu>
>
> diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
> index 5dab3ca..8b84246 100644
> --- a/tools/perf/ui/browsers/annotate.c
> +++ b/tools/perf/ui/browsers/annotate.c
> @@ -195,8 +195,9 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser)
> if (strstr(sym->name, "@plt"))
> return;
>
> - if (!cursor || !cursor->ins || !ins__is_jump(cursor->ins) ||
> - !disasm_line__has_offset(cursor))
> + if (!cursor || !cursor->ins || !ins__is_jump(cursor->ins)
> + || !disasm_line__has_offset(cursor)
> + || cursor->ops.target.offset >= symbol__size(sym))
> return;
>
> target = ab->offsets[cursor->ops.target.offset];
next prev parent reply other threads:[~2013-01-14 13:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-12 0:00 [patch] perf: tui: Fix segfault when drawing out-of-bounds jumps Frederik Deweerdt
2013-01-14 13:44 ` Arnaldo Carvalho de Melo [this message]
2013-01-14 19:47 ` Frederik Deweerdt
2013-01-25 11:50 ` [tip:perf/core] perf annotate browser: " tip-bot for Frederik Deweerdt
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=20130114134416.GA8768@infradead.org \
--to=acme@redhat.com \
--cc=frederik.deweerdt@xprog.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.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;
as well as URLs for NNTP newsgroup(s).