From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@elte.hu
Subject: Re: [PATCH] perf: add sanity check on addr in symbol__inc_addr_samples()
Date: Thu, 9 Feb 2012 12:48:45 -0200 [thread overview]
Message-ID: <20120209144844.GA4998@infradead.org> (raw)
In-Reply-To: <20120209103016.GA1999@quad>
Em Thu, Feb 09, 2012 at 11:30:16AM +0100, Stephane Eranian escreveu:
>
> Check the value of addr against the bounds of the symbol.
> This is needed given we compute an offset:
> offset = addr - sym->start
>
> And we don't want the offset to become negative.
I'll try and add a debug option to show the backtrace and values of
addr, sym, etc, so that we can fix the real problem.
I.e. this function shouldn't be receiving any such invalid addresses, as
the symbol lookup was done, the symbol was found to be this one, then
why it would be out of bounds at this point?!
- Arnaldo
> Signed-off-by: Stephane Eranian <eranian@google.com>
>
> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> index 011ed26..8248d80 100644
> --- a/tools/perf/util/annotate.c
> +++ b/tools/perf/util/annotate.c
> @@ -64,7 +64,7 @@ int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
>
> pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr));
>
> - if (addr >= sym->end)
> + if (addr >= sym->end || addr < sym->start)
> return 0;
>
> offset = addr - sym->start;
next prev parent reply other threads:[~2012-02-09 14:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-09 10:30 [PATCH] perf: add sanity check on addr in symbol__inc_addr_samples() Stephane Eranian
2012-02-09 14:48 ` Arnaldo Carvalho de Melo [this message]
2012-02-09 14:53 ` Stephane Eranian
2012-02-09 15:06 ` Sorin Dumitru
2012-02-10 14:20 ` Arnaldo Carvalho de Melo
2012-02-10 13:46 ` Arnaldo Carvalho de Melo
2012-02-10 13:49 ` Stephane Eranian
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=20120209144844.GA4998@infradead.org \
--to=acme@redhat.com \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.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