[Bug sanitizer/79096] [7 Regression] address sanitizer and jni does not work

2017-03-14 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79096

Jeffrey A. Law  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2017-03-14
 CC||law at redhat dot com
   Target Milestone|7.0 |8.0
 Ever confirmed|0   |1

--- Comment #5 from Jeffrey A. Law  ---
Upstream sanitizer runtime issue.  Deferring out of gcc-7.

[Bug sanitizer/79096] [7 Regression] address sanitizer and jni does not work

2017-02-03 Thread physiker at toast2 dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79096

--- Comment #4 from physiker at toast2 dot net ---
> Could you please raise a bug in LLVM bug tracker (https://llvm.org/bugs/)?
> All changes to sanitizer runtime library should go to LLVM and after they
> fix this bug we can backport corresponding patch to GCC.
> 
I submitted a bug report to the LLVM bug tracker. The bug id is 31861.

[Bug sanitizer/79096] [7 Regression] address sanitizer and jni does not work

2017-01-17 Thread physiker at toast2 dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79096

--- Comment #2 from physiker at toast2 dot net ---
> Am 16.01.2017 um 15:18 schrieb m.ostapenko at samsung dot com 
> :
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79096
> 
> Maxim Ostapenko  changed:
> 
>   What|Removed |Added
> 
> CC||m.ostapenko at samsung dot com
> 
> --- Comment #1 from Maxim Ostapenko  ---
> Not sure it really worked, because dlopening ASan'ed library from 
> non-sanitized
> binary without preloading libasan is a bad idea. For GCC versions 5 and 6 
> there
> wasn't any check against this for Darwin, GCC 7 pulled it with last
> libsanitizer merge from LLVM (corresponding commit in LLVM:
> http://reviews.llvm.org/D18212). Have you tried to compile your library with
> clang btw?
> 

For previous version of gcc setting DYLD_INSERT_LIBRARIES is not necessary.
Setting DYLD_INSERT_LIBRARIES as suggested for current versions of gcc 7 on the
x86_64-apple-darwin15.6.0 target does not solve the issue. On linux, preloading
libasan has always been necessary for getting the example to work. I do not
know how to successfully preload libasan on darwin. It does not seem to work
for the version of clang shipped with the operating system (Apple LLVM version
8.0.0 (clang-800.0.42.1)), either:

gcc -v -dynamiclib -fPIC -fsanitize=address
-I/System/Library/Frameworks/JavaVM.framework/Headers libTasan.c -o
libTasan.jnilib -fno-inline -fno-omit-frame-pointer -g
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
 "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple
x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage
-Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name libTasan.c
-mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim
-masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 274.2 -v
-dwarf-column-info -debug-info-kind=standalone -dwarf-version=2
-debugger-tuning=lldb -resource-dir
/Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.0.0 -I
/System/Library/Frameworks/JavaVM.framework/Headers -fdebug-compilation-dir
/Users/Peter/Devel/jni/asan -ferror-limit 19 -fmessage-length 75
-fsanitize=address
-fsanitize-blacklist=/Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.0.0/asan_blacklist.txt
-fno-assume-sane-operator-new -stack-protector 1 -fblocks -fno-inline
-fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature
-fmax-type-align=16 -fdiagnostics-show-option -o
/var/folders/97/4qnhjhtn25s86s9hkz0h37_mgn/T/libTasan-2e658d.o -x c
libTasan.c
clang -cc1 version 8.0.0 (clang-800.0.42.1) default target
x86_64-apple-darwin15.6.0
#include "..." search starts here:
#include <...> search starts here:
 /System/Library/Frameworks/JavaVM.framework/Headers
 /usr/local/include
 /Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.0.0/include
 /Library/Developer/CommandLineTools/usr/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
libTasan.c:7:3: warning: array index 10 is past the end of the array (which
  contains 10 elements) [-Warray-bounds]
  stack_array[10] = 0;
  ^   ~~
libTasan.c:6:3: note: array 'stack_array' declared here
  int stack_array[10];
  ^
1 warning generated.
 "/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -dynamic -dylib
-arch x86_64 -macosx_version_min 10.11.0 -o libTasan.jnilib
/var/folders/97/4qnhjhtn25s86s9hkz0h37_mgn/T/libTasan-2e658d.o
/Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
-rpath @executable_path -rpath
/Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.0.0/lib/darwin
-lc++abi -lSystem
/Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.0.0/lib/darwin/libclang_rt.osx.a
 "/Library/Developer/CommandLineTools/usr/bin/dsymutil" -o libTasan.jnilib.dSYM
libTasan.jnilib

bash-3.2$ java Tasan
==915==ERROR: Interceptors are not working. This may be because
AddressSanitizer is loaded too late (e.g. via dlopen). Please launch the
executable with:
DYLD_INSERT_LIBRARIES=/Library/Developer/CommandLineTools/usr/lib/clang/8.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
==915==AddressSanitizer CHECK failed:
/Library/Caches/com.apple.xbs/Sources/clang_compiler_rt/clang-800.0.42.1/src/projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc:690
"(("interceptors not installed" && 0)) != (0)" (0x0, 0x0)


Abort trap: 6

bash-3.2$
DYLD_INSERT_LIBRARIES=/Library/Developer/CommandLineTools/usr/lib/clang/8.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
java Tasan
==918==ERROR: Interceptors are not working. 

[Bug sanitizer/79096] [7 Regression] address sanitizer and jni does not work

2017-01-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79096

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |7.0
Summary|address sanitizer and jni   |[7 Regression] address
   |does not work   |sanitizer and jni does not
   ||work