Its part of a large and complected code base ! malloc and free wrappers
exists for some book keeping reason
and i am afraid  i cant change it either !
I don't know if there is way to get around this

On Wed, Dec 19, 2018 at 4:14 PM 'Alexander Potapenko' via address-sanitizer
<[email protected]> wrote:

> ASan itself is wrapping malloc() and free(), so your functions are
> messing up with ASan wrappers.
> Why exactly do you need to wrap malloc and free?
> On Wed, Dec 19, 2018 at 11:30 AM Ankur Raj <[email protected]> wrote:
> >
> > 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.
>
>
>
> --
> Alexander Potapenko
> Software Engineer
>
> Google Germany GmbH
> Erika-Mann-Straße, 33
> 80636 München
>
> Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
> Registergericht und -nummer: Hamburg, HRB 86891
> Sitz der Gesellschaft: Hamburg
>
> --
> 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.
>

-- 
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