[Pkg-db-devel] Bug#247655: svnadmin crashes with "unaligned access"

David Kimdon David Kimdon <david@kimdon.org>, 247655@bugs.debian.org
Sun, 9 May 2004 19:29:52 +0200


On Sun, May 09, 2004 at 03:09:28PM +0200, Thomas Bader wrote:
> you could explain me in short what to do I can do the
> debugging on my machine.

ok, that would be great.

> 
> I have recompiled libdb4.2 with -g and now I get a bit a
> larger back trace:

it looks like the binaries are still stripped, you should see
something more like:

(gdb) bt
#0  __memp_fopen_4002 (dbmfp=0x10050fe8, mfp=0x30069858, 
    path=0xffa2d28 "nodes", flags=128, mode=0, pagesize=4096)
    at ../mp/mp_fopen.c:916
#1  0x0fdfd264 in __memp_fopen_4002 (dbmfp=0x10050fe8, mfp=0x30069858, 
    path=0xffa2d28 "nodes", flags=128, mode=0, pagesize=4096)
    at ../mp/mp_fopen.c:914
 . . . . 

This should get you debuggable builds of bdb and subversion:
export DEB_BUILD_OPTIONS="nostrip debug"
apt-get build-dep subversion db4.2
apt-get source -b subversion
apt-get source -b db4.2

As far as how to find the problem, I don't see an easy path, but here
are some clues.

The mutex should be 16 byte aligned. I expect that when it is
allocated in mutex/mut_tas.c it _is_ 16 byte aligned.  If indeed it is
allocated properly then some time between where it is allocated and
where the exception occurs memory is corrupted.  A first step could be
to find the place where the mutex in question is allocated (trace the
stack up from the 'unhandled unaligned access' exception looking for
where the mutex is no longer in scope, then look around there for the
mutex allocation).  Now that you have where it is allocated put a break
point right after the allocation.  Now put a watchpoint on the pointer
to the mutex.  The debugger will stop when someone corrupt the pointer
to the mutex.  That someone is the culprit, now figure out how to
prevent the corruption.

Good luck!

David