perf: Properly align symbol_conf.priv_size
PATCH 1/1 perf: Properly align symbol_conf.priv_size
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()
tools/perf/util/symbol.c +2 -0
@@ -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) -
Em Mon, Mar 28, 2011 at 05:58:49PM -0700, David Miller escreveu:
Quoted 9 lines
If symbol_conf.priv_size is not a multiple of "sizeof(u64)" we'll bus error on sparc64 in
symbol__newbecause the "struct symbol *" pointer is computed by adding symbol_conf.priv_size to the memory allocated.We cannot isloate the fix to
symbol__newandsymbol__deletesince the private area is computed by subtracting thepriv_sizevalue from a "struct symbol" pointer, so then the private area can still be potentially unaligned.
That is a clever area, aka something that needs some sanitization, container_of use possibilities... attempt-possible-to-become-some-sort-of-progress. :-\
Rusty willing, vowel-optmz+=blts words to trow at that...
Quoted 17 lines
So, simply align the symbol_conf.priv_size value in
symbol__init()Signed-off-by David S. Miller <[email protected]>tools/perf/util/symbol.c +2
-0@@ -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) -
[tip:perf/urgent] perf symbols: Properly align symbol_conf.priv_size
In reply to David MillerCommit-ID: 4d439517561d009e170e2fe20be1ba25e19abe75 Gitweb: http://git.kernel.org/tip/4d439517561d009e170e2fe20be1ba25e19abe75 Author: David S. Miller <[email protected]> AuthorDate: Tue, 29 Mar 2011 14:18:39 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 29 Mar 2011 14:18:39 -0300
perf symbols: Properly align symbol_conf.priv_size
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 isolate 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()
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
LKML-Reference: <[email protected]>
--- tools/perf/util/symbol.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
tools/perf/util/symbol.c +2 -0
@@ -2406,6 +2406,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) -