Skip to content

Segmentation fault when run with AddressSanitizer #2194

Closed

Description

@hanshuang87

My progam was run with jemalloc use LD_PRELOAD=libjemalloc.so.
I want to use AddressSanitizer with jemalloc, so I built jemalloc and my program both with -fsanitize=address -fno-omit-frame-pointer.
When run my program like this:
LD_PRELOAD=/secgate/lib/libjemalloc.so ./asan_test
I got segmentation fault:
Program terminated with signal 11, Segmentation fault.
#0 0x00007fd7750e0f95 in calloc (num=1, size=32) at src/jemalloc.c:2474
2474 je_calloc(size_t num, size_t size) {
Missing separate debuginfos, use: debuginfo-install glibc-2.17-222.el7.x86_64 libasan-4.8.5-44.el7.x86_64 libgcc-4.8.5-28.el7.x86_64 libstdc++-4.8.5-28.el7.x86_64
(gdb) bt
#0 0x00007fd7750e0f95 in calloc (num=1, size=32) at src/jemalloc.c:2474
#1 0x00007fd771854620 in _dlerror_run () from /lib64/libdl.so.2
#2 0x00007fd771854128 in dlsym () from /lib64/libdl.so.2
#3 0x00007fd772144fdc in ?? () from /lib64/libasan.so.0
#4 0x00007fd7721372b9 in ?? () from /lib64/libasan.so.0
#5 0x00007fd77213990b in __asan_init_v1 () from /lib64/libasan.so.0
#6 0x00007fd775664ce3 in _dl_init_internal () from /lib64/ld-linux-x86-64.so.2
#7 0x00007fd77565606a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#8 0x0000000000000001 in ?? ()
#9 0x00007ffc98195746 in ?? ()
#10 0x0000000000000000 in ?? ()
Is there anyway to run my program with AddressSanitizer?

Activity

  1. Lapenkov commented on Dec 29, 2021

    @Lapenkov
    Contributor

    ASAN replaces malloc and free with its own implementation designed to catch out of bounds memory access.

    You should not run jemalloc with ASAN simultaneously, but you can run your tests under ASAN to catch memory bugs and use jemalloc in your production build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions