https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69147

--- Comment #6 from Maxim Ostapenko <chefmax at gcc dot gnu.org> ---
Ok, it seems that libasan calls some function to be intercepted while
AsanInitInternal still not completed. Could you try to run memcmp-1.exe under
gdb to provide a backtrace from failed CHECK? This way, we'll probably can
figure out what function was intercepted.

(In reply to Dominique d'Humieres from comment #5)
> > If you want use make check stuff, you could try this:
> >
> > max:~/build/master> setenv ASAN_OPTIONS verbosity=2:debug=1
> > max:~/build/master> make check RUNTESTFLAGS="asan.exp=memcmp-1.c"
> 
> With that I get:
> 
> LD_LIBRARY_PATH=:/opt/gcc/5_build/gcc:/opt/gcc/5_build/x86_64-apple-darwin15.
> 2.0/./libsanitizer/asan/.libs
> LD_RUN_PATH=:/opt/gcc/5_build/gcc:/opt/gcc/5_build/x86_64-apple-darwin15.2.0/
> ./libsanitizer/asan/.libs
> SHLIB_PATH=:/opt/gcc/5_build/gcc:/opt/gcc/5_build/x86_64-apple-darwin15.2.0/.
> /libsanitizer/asan/.libs
> LD_LIBRARY_PATH_32=:/opt/gcc/5_build/gcc:/opt/gcc/5_build/x86_64-apple-
> darwin15.2.0/./libsanitizer/asan/.libs
> LD_LIBRARY_PATH_64=:/opt/gcc/5_build/gcc:/opt/gcc/5_build/x86_64-apple-
> darwin15.2.0/./libsanitizer/asan/.libs
> DYLD_LIBRARY_PATH=:/opt/gcc/5_build/gcc:/opt/gcc/5_build/x86_64-apple-
> darwin15.2.0/./libsanitizer/asan/.libs
> Executing on host: /opt/gcc/5_build/gcc/xgcc -B/opt/gcc/5_build/gcc/
> fsanitize_address45391.c    
> -B/opt/gcc/5_build/x86_64-apple-darwin15.2.0/./libsanitizer/ 
> -B/opt/gcc/5_build/x86_64-apple-darwin15.2.0/./libsanitizer/asan/ 
> -L/opt/gcc/5_build/x86_64-apple-darwin15.2.0/./libsanitizer/asan/.libs 
> -fsanitize=address -g
> -I/opt/gcc/5_work/gcc/testsuite/../../libsanitizer/include
> -fno-diagnostics-show-caret -fdiagnostics-color=never  -fsanitize=address 
> -lm  -o fsanitize_address45391.exe    (timeout = 300)
> spawn -ignore SIGHUP /opt/gcc/5_build/gcc/xgcc -B/opt/gcc/5_build/gcc/
> fsanitize_address45391.c
> -B/opt/gcc/5_build/x86_64-apple-darwin15.2.0/./libsanitizer/
> -B/opt/gcc/5_build/x86_64-apple-darwin15.2.0/./libsanitizer/asan/
> -L/opt/gcc/5_build/x86_64-apple-darwin15.2.0/./libsanitizer/asan/.libs
> -fsanitize=address -g
> -I/opt/gcc/5_work/gcc/testsuite/../../libsanitizer/include
> -fno-diagnostics-show-caret -fdiagnostics-color=never -fsanitize=address -lm
> -o fsanitize_address45391.exe^M
> Executing on host: /opt/gcc/5_build/gcc/xgcc -B/opt/gcc/5_build/gcc/
> /opt/gcc/5_work/gcc/testsuite/c-c++-common/asan/memcmp-1.c    
> -B/opt/gcc/5_build/x86_64-apple-darwin15.2.0/./libsanitizer/ 
> -B/opt/gcc/5_build/x86_64-apple-darwin15.2.0/./libsanitizer/asan/ 
> -L/opt/gcc/5_build/x86_64-apple-darwin15.2.0/./libsanitizer/asan/.libs 
> -fsanitize=address -g
> -I/opt/gcc/5_work/gcc/testsuite/../../libsanitizer/include
> -fno-diagnostics-show-caret -fdiagnostics-color=never    -O0 
> -fno-builtin-memcmp  -lm  -o ./memcmp-1.exe    (timeout = 300)
> spawn -ignore SIGHUP /opt/gcc/5_build/gcc/xgcc -B/opt/gcc/5_build/gcc/
> /opt/gcc/5_work/gcc/testsuite/c-c++-common/asan/memcmp-1.c
> -B/opt/gcc/5_build/x86_64-apple-darwin15.2.0/./libsanitizer/
> -B/opt/gcc/5_build/x86_64-apple-darwin15.2.0/./libsanitizer/asan/
> -L/opt/gcc/5_build/x86_64-apple-darwin15.2.0/./libsanitizer/asan/.libs
> -fsanitize=address -g
> -I/opt/gcc/5_work/gcc/testsuite/../../libsanitizer/include
> -fno-diagnostics-show-caret -fdiagnostics-color=never -O0
> -fno-builtin-memcmp -lm -o ./memcmp-1.exe^M
> PASS: c-c++-common/asan/memcmp-1.c   -O0  (test for excess errors)
> Setting LD_LIBRARY_PATH to
> :/opt/gcc/5_build/gcc:/opt/gcc/5_build/x86_64-apple-darwin15.2.0/./
> libsanitizer/asan/.libs::/opt/gcc/5_build/gcc:/opt/gcc/5_build/x86_64-apple-
> darwin15.2.0/./libsanitizer/asan/.libs
> spawn [open ...]^M
> ==45459==Parsed ASAN_OPTIONS: verbosity=2:debug=1
> ==45459==AddressSanitizer CHECK failed:
> ../../../../5_work/libsanitizer/asan/asan_malloc_mac.cc:103
> "((!asan_init_is_running)) != (0)" (0x0, 0x0)
>     <empty stack>
> 
> PASS: c-c++-common/asan/memcmp-1.c   -O0  execution test
> FAIL: c-c++-common/asan/memcmp-1.c   -O0  output pattern test
> Output was:
> ==45459==Parsed ASAN_OPTIONS: verbosity=2:debug=1
> ==45459==AddressSanitizer CHECK failed:
> ../../../../5_work/libsanitizer/asan/asan_malloc_mac.cc:103
> "((!asan_init_is_running)) != (0)" (0x0, 0x0)
>     <empty stack>
> 
> 
> Should match:
> ERROR: AddressSanitizer: stack-buffer-overflow.*(
> |^M
> |^M)    #0 0x[0-9a-f]+ +(in _*(interceptor_|wrap_|)memcmp |[(])[^
> ^M]*(
> |^M
> |^M)    #1 0x[0-9a-f]+ +(in _*main|[(])[^
> ^M]*(
> |^M
> |^M)

Reply via email to