lkml.org 
[lkml]   [2011]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] perf: Properly align symbol_conf.priv_size
From

If symbol_conf.priv_size is not a multiple of "sizeof(u64)" we'll bus
error on sparc64 in symbol__new because the "struct symbol *" pointer
is computed by adding symbol_conf.priv_size to the memory allocated.

We cannot isloate the fix to symbol__new and symbol__delete since the
private area is computed by subtracting the priv_size value from a
"struct symbol" pointer, so then the private area can still be
potentially unaligned.

So, simply align the symbol_conf.priv_size value in symbol__init()

Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 17df793..76c09099 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -2403,6 +2403,8 @@ int symbol__init(void)
if (symbol_conf.initialized)
return 0;

+ symbol_conf.priv_size = ALIGN(symbol_conf.priv_size, sizeof(u64));
+
elf_version(EV_CURRENT);
if (symbol_conf.sort_by_name)
symbol_conf.priv_size += (sizeof(struct symbol_name_rb_node) -

\
 
 \ /
  Last update: 2011-03-29 03:01    [W:0.075 / U:4.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site