There are several problems getting TSAN on Android/AArch64 to work.
Android is missing TLS support with __thread keyword.
Using pthread api to emulate TLS is not going to work, because
of several reasons:
- bionic's pthread_create calls the INTERCEPTED version of pthread_mutex_lock
- the key cleanup code calls free() and such, but this is AFTER the main
thread has exited. This means that calling pthread_getspecific again returns
an odd address. So this means that the TLS ThreadState pointer now becomes
corrupt DURING the exit process.
So instead, I opted for a non-interceptible workaround for TLS support.
TSAN on Android also requires patches for bionic.
Please refer to https://code.google.com/p/android/issues/detail?id=179564
for details.
Please don't enable these yet. I know it's a pain, but there are some issues in ASAN on AArch64 that breaks the buildbot.
We need to get that problem fixed ASAP, so that other patches waiting (TSAN, DFSAN, etc.) can go in.