[PATCH] [Tsan] Make calloc() to not track allocated space unless thread is completely initialized
Viktor Kutuzov
vkutuzov at accesssoftek.com
Sun Oct 26 11:25:17 PDT 2014
Hi kcc, samsonov, dvyukov,
The critical section in __tsan_thread_start_func() where the associated ThreadState object is not completely initialized contains a pthread_setspecific() call which in turn use calloc() on FreeBSD. The calloc() call thus relies on under-initialized thread state data and leads to generating the "data race" kind of error.
extern "C" void *__tsan_thread_start_func(void *arg) {
...
{
ThreadState *thr = cur_thread();
// Thread-local state is not initialized yet.
ScopedIgnoreInterceptors ignore;
if (pthread_setspecific(g_thread_finalize_key,
(void *)kPthreadDestructorIterations)) {
Printf("ThreadSanitizer: failed to set thread key\n");
Die();
}
...
}
...
}
http://reviews.llvm.org/D5992
Files:
lib/tsan/rtl/tsan_interceptors.cc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5992.15463.patch
Type: text/x-patch
Size: 613 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141026/f827bc50/attachment.bin>
More information about the llvm-commits
mailing list