How to integrate Tsan with OpenJDK

Jean Christophe Beyler jcbeyler at google.com
Fri Mar 15 03:12:40 UTC 2019


Hi Florian,

I admit my lack of expertise in distribution problems and you do evidently
raise a good question of how could we package/implement the TSAN portion to
be use-able by OpenJDK distributors and also by users who just build
everything from scratch.

- I would imagine that there might/should be a means to check at runtime if
the libc you've been built with is the same as the one on the OS you are
running with
   - But that might be too restrictive, complicated

- I could imagine the distribution could also potentially keep a tsan
library in sync by then just having everything as a dynamic library?
Loading and setting up interceptors might be interesting :)

- Do you have any ideas on how this could work from a distribution
perspective?

We are far far away from facing this issue but having an idea of a path
forward is always good to have so I'm happy that we are talking about it
now :).

For what it is worth, my current first step was to get us to have a
java_tsan library that is built as a separate launcher and loads up the
tsan library somehow and then just works. And for what it is worth, though
our internal implementation does do native TSAN, it is not an automatic
first goal of this work, preferring to stay only in Java land. Though it is
a nice stretch goal to have as we have seen it being useful for our users,
Jc

On Thu, Mar 14, 2019 at 5:41 AM Florian Weimer <fweimer at redhat.com> wrote:

> * Jean Christophe Beyler:
>
> > Florian Weimer said in
> > https://mail.openjdk.java.net/pipermail/discuss/2019-March/005007.html:
> >
> > "If OpenJDK starts to poke at libc internals, like the sanitizers do
> today, OpenJDK will
> > potentially need porting to each new libc version.
> >
> > You will not be able to run older OpenJDK versions on newer libcs, as it
> is possible today.
> >
> > It will likely make it more complicated to build binaries which are
> compatible with a wide
> > range of systems.
> >
> > This is what we see with the sanitizers in LLVM and GCC today.  If you
> copy a variant of this
> > code into OpenJDK, you will have the same problem."
> >
> > The conversation here is:
> >   - How do we distribute OpenJDK with a TSAN implementation?
> >     - What does that look like?
> >    - What restrictions/promises to users should we make? What should we
> not make as
> > promises?
> >
> > I have no answers to these (though I have opinions :-)); I open the
> > floor to others who would want to talk/think about these issues...
>
> I should point out that this only applies to the native TSAN code with
> its interceptors.  I don't know if there's a plan to support tracking
> across JNI boundaries and integrate with the native TSAN.
>
> If the plan is integration with native TSAN, it could be an opportunity
> to clean this up (finally).
>
> Thanks,
> Florian
>


-- 

Thanks,
Jc


More information about the tsan-dev mailing list