public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* perf per-symbol histogram causes memory corruption
@ 2010-02-25 10:26 David Miller
  2010-02-25 11:11 ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2010-02-25 10:26 UTC (permalink / raw)
  To: a.p.zijlstra; +Cc: paulus, mingo, linux-kernel


When builtin-annotate.c processes sample events via
process_sample_event() it uses 'sample_filter'

sample_filter() sizes the histogram object for a symbol based upon the
size, calculated as "sym->end - sym->start", to determine the number
of IP sample slots to allocate.

The problem is, the sym->end value is not stable at this point.

For example, dso__load_sym() first loads all of the symbols, then it
makes another pass over the symbols by calling symbols__fixup_end()
which will adjust the sym->end values of various symbols.

At this point, the histogram IP sample array allocated by
sample_filter() can become too small, and hits recorded can thus
access past the end of the array corrupting memory.

I get this very reliably on sparc64, and it took me a few days to root
cause this. :-)

I don't see an immediate way to fix this, any ideas?


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-02-25 16:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-25 10:26 perf per-symbol histogram causes memory corruption David Miller
2010-02-25 11:11 ` Ingo Molnar
2010-02-25 14:13   ` Arnaldo Carvalho de Melo
2010-02-25 15:02     ` David Miller
2010-02-25 15:57       ` Arnaldo Carvalho de Melo
2010-02-25 16:25         ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox