[lkml]   [2012]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[ 23/68] perf hists: Catch and handle out-of-date hist entry maps.
    3.2-stable review patch.  If anyone has any objections, please let me know.


    From: David Miller <>

    commit 63fa471dd49e9c9ce029d910d1024330d9b1b145 upstream.

    When a process exec()'s, all the maps are retired, but we keep the hist
    entries around which hold references to those outdated maps.

    If the same library gets mapped in for which we have hist entries, a new
    map will be created. But when we take a perf entry hit within that map,
    we'll find the existing hist entry with the older map.

    This causes symbol translations to be done incorrectly. For example,
    the perf entry processing will lookup the correct uptodate map entry and
    use that to calculate the symbol and DSO relative address. But later
    when we update the histogram we'll translate the address using the
    outdated map file instead leading to conditions such as out-of-range
    offsets in symbol__inc_addr_samples().

    Therefore, update the map of the hist_entry dynamically at lookup/
    creation time.

    Signed-off-by: David S. Miller <>
    Signed-off-by: Arnaldo Carvalho de Melo <>
    Signed-off-by: Greg Kroah-Hartman <>

    tools/perf/util/hist.c | 12 ++++++++++++
    1 file changed, 12 insertions(+)

    --- a/tools/perf/util/hist.c
    +++ b/tools/perf/util/hist.c
    @@ -230,6 +230,18 @@ struct hist_entry *__hists__add_entry(st
    if (!cmp) {
    he->period += period;
    + /* If the map of an existing hist_entry has
    + * become out-of-date due to an exec() or
    + * similar, update it. Otherwise we will
    + * mis-adjust symbol addresses when computing
    + * the history counter to increment.
    + */
    + if (he-> != entry-> {
    + he-> = entry->;
    + if (he->
    + he->>referenced = true;
    + }
    goto out;

     \ /
      Last update: 2012-04-19 23:31    [W:0.023 / U:3.652 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site