perf hists: Catch and handle out-of-date hist entry maps.
authorDavid Miller <davem@davemloft.net>
Tue, 27 Mar 2012 07:14:18 +0000 (03:14 -0400)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 30 Apr 2012 18:15:13 +0000 (19:15 +0100)
commitda73aa6863325ef70b934d39677ba89a30ec36ff
tree8e0ce07645462b48ee4de14fdbd0bc7a6b42be63
parenta7189f6ff59bd8c2ffd6780c06b6da060d1ed02f
perf hists: Catch and handle out-of-date hist entry maps.

BugLink: http://bugs.launchpad.net/bugs/987337

Backported from 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 <davem@davemloft.net>
Link: http://lkml.kernel.org/r/20120327.031418.1220315351537060808.davem@davemloft.net
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
tools/perf/util/hist.c