title: Using address sanitizer with surefire
body: <p>I'm trying to build shared library with <code>JNI</code> functions with GCC's address sanitizer to use in tests. Since jvm itself is not built with adress sinitizer there is a LD_PRELOAD trick to make it work as discribed in this <a href="https://github.com/google/sanitizers/issues/679" rel="nofollow noreferrer">issue</a>. </p>
  
  <p>So I configured <code>maven-surefire-plugin</code> as follows:</p>
  
  <pre><code>&lt;configuration&gt;
       &lt;forkMode&gt;always&lt;/forkMode&gt;
       &lt;environmentVariables&gt;
             &lt;LD_PRELOAD&gt;/usr/lib/x86_64-linux-gnu/libasan.so.4.0.0&lt;/LD_PRELOAD&gt;
       &lt;/environmentVariables&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>But <code>mvn clean install</code> still crashes with SEGV as follows:</p>
  
  <pre><code>-------------------------------------------------------
   T E S T S
  -------------------------------------------------------
  ASAN:DEADLYSIGNAL
  =================================================================
  ==1225==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 
  </code></pre>
  
  <p>failing the build. From <a href="https://stackoverflow.com/a/36258856/2786156">this answer</a> I concluded that because of JVM uses signals for its own purpose such SEGV caused by reading on zero address is expected.</p>
  
  <p>Is there a way to work around this? Maybe it is safe to simply ignore <code>SEGV</code> when running with sanitizers similar to when debugging JVM with <code>gdb</code>?</p>