[PATCH]: backport fix for PR sanitizer/58994

Kostya Serebryany kcc@google.com
Thu Nov 14 15:58:00 GMT 2013


On Thu, Nov 14, 2013 at 6:24 PM, Jack Howarth <howarth@bromo.med.uc.edu> wrote:
>    The attached patch backports http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20131111/194748.html
> to gcc trunk and eliminates the asan.exp failures at -m64 on darwin. Bootstrap and regression tested on
> x86_64-apple-darwin12 and x86_64-apple-darwin13.
>                         Jack
> ps Kostya, can you handled the commit? Thanks in advance.

Will do (tomorrow)

--kcc

>
> 2013-11-14  Kostya Serebryany  <kcc@google.com>
>             Jack Howarth  <howarth@bromo.med.uc.edu>
>
> libsanitizer/
>
>         PR sanitizer/58994
>         Backport from upstream revision 194573
>         * asan/asan_interceptors.cc (COMMON_INTERCEPTOR_ENTER): Fall
>         back to the original functions in the common libsanitizer
>         interceptors and the __cxa_atexit() interceptor on Darwin.
>
>
> Index: libsanitizer/asan/asan_interceptors.cc
> ===================================================================
> --- libsanitizer/asan/asan_interceptors.cc      (revision 204753)
> +++ libsanitizer/asan/asan_interceptors.cc      (working copy)
> @@ -106,12 +106,13 @@ DECLARE_REAL_AND_INTERCEPTOR(void, free,
>  #define COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, size) \
>    ASAN_WRITE_RANGE(ptr, size)
>  #define COMMON_INTERCEPTOR_READ_RANGE(ctx, ptr, size) ASAN_READ_RANGE(ptr, size)
> -#define COMMON_INTERCEPTOR_ENTER(ctx, func, ...)              \
> -  do {                                                        \
> -    if (asan_init_is_running) return REAL(func)(__VA_ARGS__); \
> -    ctx = 0;                                                  \
> -    (void) ctx;                                               \
> -    ENSURE_ASAN_INITED();                                     \
> +#define COMMON_INTERCEPTOR_ENTER(ctx, func, ...)                       \
> +  do {                                                                 \
> +    if (asan_init_is_running) return REAL(func)(__VA_ARGS__);          \
> +    ctx = 0;                                                           \
> +    (void) ctx;                                                        \
> +    if (SANITIZER_MAC && !asan_inited) return REAL(func)(__VA_ARGS__); \
> +    ENSURE_ASAN_INITED();                                              \
>    } while (false)
>  #define COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd) \
>    do {                                         \
> @@ -634,6 +635,9 @@ static void AtCxaAtexit(void *unused) {
>  #if ASAN_INTERCEPT___CXA_ATEXIT
>  INTERCEPTOR(int, __cxa_atexit, void (*func)(void *), void *arg,
>              void *dso_handle) {
> +#if SANITIZER_MAC
> +  if (!asan_inited) return REAL(__cxa_atexit)(func, arg, dso_handle);
> +#endif
>    ENSURE_ASAN_INITED();
>    int res = REAL(__cxa_atexit)(func, arg, dso_handle);
>    REAL(__cxa_atexit)(AtCxaAtexit, 0, 0);



More information about the Gcc-patches mailing list