[PATCH] [Tsan] Make calloc() to not track allocated space unless thread is completely initialized
Dmitry Vyukov
dvyukov at google.com
Mon Oct 27 03:28:14 PDT 2014
Will the following do?
--- lib/tsan/rtl/tsan_interceptors.cc (revision 220555)
+++ lib/tsan/rtl/tsan_interceptors.cc (working copy)
@@ -872,11 +872,13 @@
ThreadState *thr = cur_thread();
// Thread-local state is not initialized yet.
ScopedIgnoreInterceptors ignore;
+ ThreadIgnoreBegin(thr, 0);
if (pthread_setspecific(g_thread_finalize_key,
(void *)kPthreadDestructorIterations)) {
Printf("ThreadSanitizer: failed to set thread key\n");
Die();
}
+ ThreadIgnoreEnd(thr, 0);
while ((tid = atomic_load(&p->tid, memory_order_acquire)) == 0)
pthread_yield();
atomic_store(&p->tid, 0, memory_order_release);
I've tested that 'make presubmit' passes with this change.
If it works for freebsd, then I pre-approve such change.
I strongly don't want to touch malloc interceptors without a significant reason. The set of things that we ignore and don't ignore in malloc interceptors is crafted over several years. There is long tail of implications on Java integration, Chromium with non-instrumented libraries and other weird contexts. We don't have any known issues with the current version.
http://reviews.llvm.org/D5992
More information about the llvm-commits
mailing list