[RFR] Create interface to call TSAN runtime

Jean Christophe Beyler jcbeyler at google.com
Mon Mar 25 18:01:23 UTC 2019


Hi Arthur,

LGTM, thanks!

My only nit would be that your file:
http://cr.openjdk.java.net/~aeubanks/tsaninit/webrev.00/src/hotspot/share/runtime/tsanExternalDecls.hpp.html

contains all the methods we use. Would we want to add into it incrementally
instead? I'm indifferent both ways, just wondering :)
Jc

On Mon, Mar 25, 2019 at 10:41 AM Arthur Eubanks <aeubanks at google.com> wrote:

> Hi,
>
> Here's a patch which allows the JVM to call into TSAN runtime functions.
> With the -XX:+ThreadSanitizer flag it will call __tsan_java_init() on
> startup, and will call __tsan_java_fini() on shutdown, exiting with
> whatever __tsan_java_fini() returns if non-zero.
>
> Currently the way to provide the TSAN runtime is with LD_PRELOAD. In the
> future we will have a better way, but this is the current short-term
> solution so we can iterate faster.
>
> $ LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/8/libtsan.so
> ./images/jdk/bin/java -XX:+ThreadSanitizer
> works, reports some internal JVM races, and exits with 66, the default exit
> code when TSAN finds any races.
>
> $ LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/8/libtsan.so
> TSAN_OPTIONS="exitcode=123" ./images/jdk/bin/java -XX:+ThreadSanitizer ;
> echo $?
> Overriding the default TSAN error exit code works.
>
> http://cr.openjdk.java.net/~aeubanks/tsaninit/webrev.00/index.html
>


-- 

Thanks,
Jc


More information about the tsan-dev mailing list