mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: Sorin Dumitru <dumitru.sorin87@gmail.com>
Cc: linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl
Subject: Re: [PATCH] perf: check if address is in range
Date: Fri, 13 Jan 2012 10:25:47 -0200	[thread overview]
Message-ID: <20120113122547.GA8161@infradead.org> (raw)
In-Reply-To: <1326400778-24131-1-git-send-email-dumitru.sorin87@gmail.com>

Em Thu, Jan 12, 2012 at 10:39:38PM +0200, Sorin Dumitru escreveu:
> When addr isn't in the [sym->start,sym->end] range offset
> will be a very big value, giving us a segfault when we do:
> 	h->addr[offset]++
> Fix this by checking that addr is in the correct range.

Is this against what tree? Can you please provide a backtrace of when
this happens?

I ask this because this is a kind of BUG_ON() situation, one shouldn't
get to this point if the address is not within that symbol.

- Arnaldo
 
> Signed-off-by: Sorin Dumitru <dumitru.sorin87@gmail.com>
> ---
>  tools/perf/util/annotate.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> index 011ed26..4ddc55f 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->start || addr >= sym->end)
>  		return 0;
>  
>  	offset = addr - sym->start;
> -- 
> 1.7.8.3

  parent reply	other threads:[~2012-01-13 12:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-12 20:39 Sorin Dumitru
2012-01-12 20:49 ` Daniel Baluta
2012-01-12 20:59   ` Sorin Dumitru
2012-01-12 20:55 ` Sorin Dumitru
2012-01-13 12:25 ` Arnaldo Carvalho de Melo [this message]
2012-01-13 16:35   ` Sorin Dumitru
2012-01-29 18:04     ` Sorin Dumitru

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=20120113122547.GA8161@infradead.org \
    --to=acme@ghostprotocols.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=dumitru.sorin87@gmail.com \
    --cc=linux-kernel@vger.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

Powered by JetHome