Subject: Re: core dumps because of posix_memalign
To: None <current-users@NetBSD.org>
From: Andrew Doran <ad@netbsd.org>
List: current-users
Date: 12/01/2007 16:01:01
On Sat, Dec 01, 2007 at 01:59:59PM +0100, Thomas Klausner wrote:

> I updated my amd64 kernel+userland from 4.99.36/20071118 to
> 4.99.38/20071130, and quite a few pkgsrc programs dump core during
> startup (python, mlterm, devilspie). Others work fine (X server,
> wmpload, screen).
>
> The backtrace for mlterm and python looks like this:
> (gdb) bt
> #0  0x00007f7ffbb8fc96 in posix_memalign () from /usr/lib/libc.so.12
> #1  0x00007f7ffbb902eb in malloc () from /usr/lib/libc.so.12
> #2  0x00007f7ffbb6ff66 in pthread_atfork () from /usr/lib/libc.so.12
> #3  0x00007f7ffb90a67e in pthread__init () from /usr/lib/libpthread.so.0
> #4  0x00007f7ffbbd5ffb in __errno () from /usr/lib/libc.so.12
> #5  0x00007f7ffbb2c4be in _init () from /usr/lib/libc.so.12
> #6  0x00007f7fffffe7f0 in ?? ()
> #7  0x00007f7ffde0451a in _rtld_call_init_functions ()
>    from /usr/libexec/ld.elf_so
> #8  0x00007f7ffde044dd in _rtld_call_init_functions ()
>    from /usr/libexec/ld.elf_so
> #9  0x00007f7ffde04a09 in _rtld () from /usr/libexec/ld.elf_so
> #10 0x00007f7ffde0391f in .rtld_start () from /usr/libexec/ld.elf_so
> #11 0x00007f7fffffffe0 in ?? ()
> #12 0x0000000000000000 in ?? ()
> 
> It seems to me that libc.so.12.155 and libc.so.12.156 are not binary
> compatible.

It's not a binary compatibility issue but a severe problem with the dynamic
linker. It's loading (i.e. calling mmap() on) libpthread twice. It also
tries to initialize libc and hence libpthread twice. malloc() failing is a
side effect of that. I have no idea what the root cause is but I'm trying to
figure it out at the moment.

Thanks,
Andrew