[RFR] Create interface to call TSAN runtime
Arthur Eubanks
aeubanks at google.com
Mon Mar 25 17:39:57 UTC 2019
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
More information about the tsan-dev
mailing list