lkml.org 
[lkml]   [2012]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] perf: check if address is in range
    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


    \
     
     \ /
      Last update: 2012-01-13 13:29    [W:0.022 / U:0.496 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site