[llvm-bugs] [Bug 31861] New: address sanitizer and jni does not work

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 3 15:36:47 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31861

            Bug ID: 31861
           Summary: address sanitizer and jni does not work
           Product: clang
           Version: 3.9
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: physiker at toast2.net
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 17935
  --> https://llvm.org/bugs/attachment.cgi?id=17935&action=edit
Source code and make.sh

I utilize the address sanitizer to detect errors in shared libraries. When I
try to interface a shared library with java via jni the address
sanitizer it does no longer work. This has been working with gcc versions 5, 6
and
earlier versions of gcc 7.

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.

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)) or with clang 3.9.0, either:
Therefore,
Maxim Ostapenko asked me to submit a bug report in the LLVM bug tracker:
(See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79096)

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

./make.sh 
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.
==99845==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=/sw/opt/llvm-3.9/lib/clang/3.9.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
"interceptors not installed" && 0./make.sh: line 7: 99845 Abort trap:
6
DYLD_INSERT_LIBRARIES=/sw/opt/llvm-3.9/lib/clang/3.9.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
java Tasan

clang-3.9 --version
clang version 3.9.0 (tags/RELEASE_390/final)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /sw/bin

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170203/6af763a1/attachment.html>


More information about the llvm-bugs mailing list