Hi folks,
i have a scenario where i need to wrap malloc and free calls and use dlsym 
! now i want to use address sanitiser with but it fails with 
ASAN:DEADLYSIGNAL
=================================================================
==4769==ERROR: AddressSanitizer: stack-overflow on address 0x7fffc9c3eff8 
(pc 0x0000004008c4 bp 0x7fffc9c3f020 sp 0x7fffc9c3f000 T0)

A simple reproducible  code is as follow 
#include <stdio.h>

void* malloc(size_t sz)
{
    void *(*libc_malloc)(size_t) = dlsym(RTLD_NEXT, "malloc");
    return libc_malloc(sz);
}

void free(void *p)
{
    void (*libc_free)(void*) = dlsym(RTLD_NEXT, "free");
    libc_free(p);
}

int main()
{
    malloc(10);
    return 0;
}

This when compiled with asan flags fails with error

ASAN:DEADLYSIGNAL
=================================================================
==4769==ERROR: AddressSanitizer: stack-overflow on address 0x7fffc9c3eff8 
(pc 0x0000004008c4 bp 0x7fffc9c3f020 sp 0x7fffc9c3f000 T0)
    #0 0x4008c3 in free /scratch/example/asan/sample.c:14
    #1 0x7f2b0cd275e4 in _dlerror_run (/lib64/libdl.so.2+0x15e4)
    #2 0x7f2b0cd27127 in __dlsym (/lib64/libdl.so.2+0x1127)
    #3 0x4008c8 in free /scratch/example/asan/sample.c:14
    #4 0x7f2b0cd275e4 in _dlerror_run (/lib64/libdl.so.2+0x15e4)
    #5 0x7f2b0cd27127 in __dlsym (/lib64/libdl.so.2+0x1127)
    #6 0x4008c8 in free /scratch/example/asan/sample.c:14
    #7 0x7f2b0cd275e4 in _dlerror_run (/lib64/libdl.so.2+0x15e4)
    #8 0x7f2b0cd27127 in __dlsym (/lib64/libdl.so.2+0x1127)
    #9 0x4008c8 in free /scratch/example/asan/sample.c:14
    #10 0x7f2b0cd275e4 in _dlerror_run (/lib64/libdl.so.2+0x15e4)



-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to