I'm getting a SIGBUS on every backtrace libbacktrace generates on 32-bit sparc builds. The crashes usually happen in add_function_range(), where 'p' is not 8-byte aligned.
It seems that the vector code doesn't take care to align the pointers it returns. I cribbed the size alignment done in mmap.c's implementation of backtrace_alloc() to fix this. Ok to install? libbacktrace/ 2012-10-26 David S. Miller <da...@davemloft.net> * alloc.c (backtrace_vector_grow): Round size up to a multiple of 8. * mmap.c (backtrace_vector_grow): Likewise. diff --git a/libbacktrace/alloc.c b/libbacktrace/alloc.c index 501f386..59072ed 100644 --- a/libbacktrace/alloc.c +++ b/libbacktrace/alloc.c @@ -78,6 +78,10 @@ backtrace_vector_grow (struct backtrace_state *state ATTRIBUTE_UNUSED, { void *ret; + /* Round for alignment; we assume that no type we care about + is more than 8 bytes. */ + size = (size + 7) & ~ (size_t) 7; + if (size > vec->alc) { size_t alc; diff --git a/libbacktrace/mmap.c b/libbacktrace/mmap.c index e07810d..6e51a0d 100644 --- a/libbacktrace/mmap.c +++ b/libbacktrace/mmap.c @@ -175,6 +175,10 @@ backtrace_vector_grow (struct backtrace_state *state,size_t size, { void *ret; + /* Round for alignment; we assume that no type we care about + is more than 8 bytes. */ + size = (size + 7) & ~ (size_t) 7; + if (size > vec->alc) { size_t pagesize;