On Fri, 27 Jun 2025 07:13:26 GMT, Matthias Baesken <mbaes...@openjdk.org> wrote:

>> There are a number of :tier3 HS jtreg tests using libjsig. Unfortunately 
>> they clash with asan, so it should be avoided to run them if asan is 
>> configured.
>> 
>> Examples :
>> runtime/signal/TestSigalrm.java
>> runtime/signal/TestSigbus.java
>> 
>> They run into errors like this
>> 
>> 
>>  stdout: [];
>>  stderr: [==59482==ASan runtime does not come first in initial library list; 
>> you should either link runtime to your application or manually preload it 
>> with LD_PRELOAD.
>> 
>> 
>> One option would be to avoid running those tests when  asan is enabled.
>> Another option is to avoid the  so called 'link  order check' .
>> https://github.com/google/sanitizers/wiki/addresssanitizerflags
>> 
>> verify_asan_link_order  -  Check position of ASan runtime in library list 
>> (needs to be disabled when other library has to be preloaded system-wide)
>
> Matthias Baesken has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Readjust COPYRIGHT year

Saw this too late. I am unsure about this change, because it disables a rather 
necessary warning. ASAN interposes a number of APIs, e.g. malloc/free. Bad 
things can happen if that interposition does not cover the full JVM process. 

E.g. you preload library1, which comes before ASAN interposition is in place, 
so it uses libc malloc. You then load ASAN, then the rest of JVM. Anything 
loaded after ASAN will route through ASAN's version of malloc/free. So 
different parts of the process could use different versions of malloc/free. 
That could be trouble since we don't know whether pointers returned from raw 
libc malloc are compatible with ASAN's version of free, and vice versa. Even if 
nothing like that happens, it would quietly disable ASAN for a part of the 
libjvm, e.g. in case of libjsig for the libjsig.

Unless we fully understand what would happen in these cases, I would not switch 
off these warning for the full process. Rather just switch off tests on ASAN 
builds that rely on LD_PRELOAD. We don't have that many (should only be 
libjsig, no?)

This is just my 5 cents. I think ASAN is really useful, and the bugs @MBaesken 
already found proves that.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25978#issuecomment-3113258471

Reply via email to