Hi Jason,
ThreadSanitizer does not intercept syscall(SYS_FUTEX) and so it misses
any synchronization this call provides.
+Evgenii, do you remember why we don't intercept syscall function? Our
syscall machinery seems to require manual annotations, but for syscall
we could do it all automatically.
Jason, as a workaround you could add manual annotations around futex
calls, along the following lines:
#ifdef THREAD_SANITIZER
extern "C" void __tsan_acquire(void *addr);
extern "C" void __tsan_release(void *addr);
#else
inline void __tsan_acquire(void *addr) {}
inline void __tsan_release(void *addr) {}
#endif
__tsan_release(addr);
syscall(FUTEX_WAKE, addr, ...);
if (syscall(FUTEX_WAIT, addr, ...) == 0)
__tsan_acquire(addr);
And then compile with -fsanitize=thread -DTHREAD_SANITIZER.
Latest clang versions provide tsan_interface.h header with these
functions, but I don't know if gcc provides it.