All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: Properly align symbol_conf.priv_size
@ 2011-03-29  0:58 David Miller
  2011-03-29  3:07 ` Arnaldo Carvalho de Melo
  2011-03-30  7:17 ` [tip:perf/urgent] perf symbols: " tip-bot for David S. Miller
  0 siblings, 2 replies; 3+ messages in thread
From: David Miller @ 2011-03-29  0:58 UTC (permalink / raw)
  To: a.p.zijlstra; +Cc: paulus, mingo, acme, linux-kernel


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) -

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

* Re: [PATCH] perf: Properly align symbol_conf.priv_size
  2011-03-29  0:58 [PATCH] perf: Properly align symbol_conf.priv_size David Miller
@ 2011-03-29  3:07 ` Arnaldo Carvalho de Melo
  2011-03-30  7:17 ` [tip:perf/urgent] perf symbols: " tip-bot for David S. Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-03-29  3:07 UTC (permalink / raw)
  To: David Miller; +Cc: a.p.zijlstra, paulus, mingo, linux-kernel

Em Mon, Mar 28, 2011 at 05:58:49PM -0700, David Miller escreveu:
> 
> 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.

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...
 
> 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) -

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

* [tip:perf/urgent] perf symbols: Properly align symbol_conf.priv_size
  2011-03-29  0:58 [PATCH] perf: Properly align symbol_conf.priv_size David Miller
  2011-03-29  3:07 ` Arnaldo Carvalho de Melo
@ 2011-03-30  7:17 ` tip-bot for David S. Miller
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for David S. Miller @ 2011-03-30  7:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, davem, tglx,
	mingo

Commit-ID:  4d439517561d009e170e2fe20be1ba25e19abe75
Gitweb:     http://git.kernel.org/tip/4d439517561d009e170e2fe20be1ba25e19abe75
Author:     David S. Miller <davem@davemloft.net>
AuthorDate: Tue, 29 Mar 2011 14:18:39 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
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 <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20110328.175849.112593455.davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 8f73907..f06c10f 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -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) -

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

end of thread, other threads:[~2011-03-30  7:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-29  0:58 [PATCH] perf: Properly align symbol_conf.priv_size David Miller
2011-03-29  3:07 ` Arnaldo Carvalho de Melo
2011-03-30  7:17 ` [tip:perf/urgent] perf symbols: " tip-bot for David S. Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.