On Mon, Jul 28, 2014 at 1:25 PM, ji wang <[email protected]> wrote:
> Hi, kcc
>
>>On Linux, you typically have to link the asan run-time to the
>>executable, but see
>>https://code.google.com/p/address-sanitizer/wiki/AsanAsDso
>
> Do we have to use LD_PRELOAD to preload this asan run-time Dso to the
> process before this Asan instrumented executable run?And why?
> I've tried not preload the asan run-time at first, and I got the

Please give more context: where did you try that and what exactly did you do.

> "AddressSanitizer: failed to intercept 'memcpy'" error, And I tried to fix
> it by this modification of the code:
>
> --- a/gcc-4.9/libsanitizer/interception/interception_linux.cc
> +++ b/gcc-4.9/libsanitizer/interception/interception_linux.cc
> @@ -12,13 +12,31 @@
>
>  namespace __interception {
>  bool GetRealFunctionAddress(const char *func_name, uptr *func_addr,
>      uptr real, uptr wrapper) {
> +  char *err;
> +  void *handle = dlopen("libc.so", RTLD_NOW);
> -  *func_addr = (uptr)dlsym(RTLD_NEXT, func_name);
> +  *func_addr = (uptr)dlsym(handle, func_name);
> +  err = (char *)dlerror();
> +  if(err){
> +       Printf("---GetRealFunctionAddress: error in dlsym: (%s)\n", err);
> +  }
> +  dlclose(handle);
>
>    return real == wrapper;
>  }
> And after this modification, everything went ok. Dose this code modified
> properly? Or have any side effect?
>
>
> --
> 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