[PATCH] D31449: [tsan] Don't report deadlocks when ignore_reads_and_writes > 0

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 14:11:54 PDT 2017


kubamracek added a comment.

In https://reviews.llvm.org/D31449#714004, @dvyukov wrote:

> When an interceptor comes from a non-instrumented library, we set thr->in_ignored_lib=true. This causes SCOPED_TSAN_INTERCEPTOR to call the real function an skip all tsan processing. Consequently mutex lock/unlock operations in non-instrumented libraries are not handled by tsan already. So it's not clear to me how you get deadlock reports there. What am I missing?


There's two issues with the current state of things:

1. in_ignored_lib=true only affects second (nested) calls to other interceptor.  So if a libignored library directly calls pthread_mutex_lock+pthread_mutex_unlock, those interceptors are still called and they detect deadlocks.
2. Even if libignore affects direct interceptor calls, we'd have even more issues, because the pthread_mutex_lock+pthread_mutex_unlock interceptors provide important synchronization and if we just ignore them, we'll get even more false positives.

What I'm suggesting is:  Non-instrumented modules should still call interceptors like pthread_mutex_lock+pthread_mutex_unlock, but these should just not report any issues, including deadlocks.  Do you disagree?


Repository:
  rL LLVM

https://reviews.llvm.org/D31449





More information about the llvm-commits mailing list