Open davidben opened 7 years ago
I played with this a little yesterday. Progress so far:
If you build and link with -fsanitize=address
, the resulting .so file has a dependency on the ASan runtime. (See #286)
New enough clang (I use the one from Chromium) support a -shared-libasan
flag which makes the .so file include a dependency on the runtime, but you need to set LD_LIBRARY_PATH
to the relevant directory for it to pick it up.
If you do that, it complains the ASan runtime isn't first in the link order. That can be suppressed with ASAN_OPTIONS=verify_asan_link_order=0
, but then it complains that the address space ASan would be using is already taken, presumably by Java.
I found some references which suggests one should LD_PRELOAD
the runtime instead, which should avoid the need for -shared-libasan
I think? But if I do that on gradlew
, java
crashes in free
. If I could instead pass that only to the test incantation, there's a chance that might work better? But I haven't yet gotten a full manual command out of Gradle to toy with. Someone who understands that buildsystem better may be better-suited here.
C++ tooling is much much better now than it used to be. There have been a lot of problems with Conscrypt that would have been immediately caught by tools like ASan.