Crash with programs linked with libasan

Ruslan Kabatsayev b7.10110111 at gmail.com
Fri May 20 06:08:47 PDT 2016


Hello,

Jemalloc seems to be incompatible with libasan (or am I using it
incorrectly?). Here's how to reproduce the problem with a simple C
program:

int main(){return 0;}

Compile it with the following command (tested on Kubuntu 14.04 amd64,
with gcc 5.3.0-3ubuntu1~14.04):

gcc test.c -o test -fsanitize=address

Then run it this way:

LD_PRELOAD=$HOME/opt/jemalloc/lib/libjemalloc.so.2 ./test

and get a crash:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007ffff7b82720 in je_malloc_mutex_lock (tsdn=0x0,
mutex=0x7ffff7dd81c0 <init_lock>) at
include/jemalloc/internal/mutex.h:94
#2  malloc_init_hard () at src/jemalloc.c:1401
#3  0x00007ffff7b865ed in malloc_init () at src/jemalloc.c:302
#4  ialloc_body (slow_path=true, usize=<synthetic pointer>,
tsdn=<synthetic pointer>, zero=true, size=<optimized out>) at
src/jemalloc.c:1498
#5  calloc (num=<optimized out>, size=<optimized out>) at src/jemalloc.c:1739
#6  0x00007ffff642b690 in _dlerror_run
(operate=operate at entry=0x7ffff642b130 <dlsym_doit>,
args=args at entry=0x7fffffffd840) at dlerror.c:141
#7  0x00007ffff642b198 in __dlsym
(handle=handle at entry=0xffffffffffffffff,
name=name at entry=0x7ffff6cddfba "textdomain") at dlsym.c:70
#8  0x00007ffff6cc48dc in __interception::GetRealFunctionAddress
(func_name=func_name at entry=0x7ffff6cddfba "textdomain",
func_addr=func_addr at entry=0x7ffff71227a8
<__interception::real_textdomain>,
    real=real at entry=140737333459696,
wrapper=wrapper at entry=140737333459696) at
../../../../src/libsanitizer/interception/interception_linux.cc:21
#9  0x00007ffff6c9a20f in InitializeCommonInterceptors () at
../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4738
#10 __asan::InitializeAsanInterceptors () at
../../../../src/libsanitizer/asan/asan_interceptors.cc:734
#11 0x00007ffff6cade18 in __asan::AsanInitInternal () at
../../../../src/libsanitizer/asan/asan_rtl.cc:595
#12 0x00007ffff7dea28a in _dl_init (main_map=0x7ffff7ffe1c8, argc=1,
argv=0x7fffffffd938, env=0x7fffffffd948) at dl-init.c:111
#13 0x00007ffff7ddb30a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#14 0x0000000000000001 in ?? ()
#15 0x00007fffffffdd5c in ?? ()
#16 0x0000000000000000 in ?? ()


Regards,
Ruslan


More information about the jemalloc-discuss mailing list