[llvm-dev] call_once and TSan

Kuba Brecka via llvm-dev
Thu, 01 Sep 2016 12:30:25 -0000

Hi,

I'm trying to write a TSan interceptor for the C++11 call_once function.
There are currently false positive reports, because the inner __call_once
function is located in the (non-instrumented) libcxx library, and on macOS we
can't expect the users to build their own instrumented libcxx.

TSan already supports pthread_once and dispatch_once by having interceptors that
re-implement the logic.  However, doing the same for call_once/__call_once
doesn't work, because call_once is explicitly supposed to be exception-safe,
but the sanitizer runtime libraries disallow exception handling.

Any ideas how to handle call_once in TSan?

Thanks!
Kuba