[PATCH] D16214: [tsan] Fix ScopedInterceptor's handling of !thr->is_inited

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 01:57:11 PST 2016


kubabrecka created this revision.
kubabrecka added reviewers: dvyukov, yabinc, kcc, eugenis, glider, samsonov.
kubabrecka added subscribers: llvm-commits, zaks.anna.

The commit r257866 (https://github.com/llvm-mirror/compiler-rt/commit/b78f9c1f623e5faa4cca68227ab536ae80f9fc16, differential revision http://reviews.llvm.org/D15301, which is slightly different than the commit) introduced a test failure in `Darwin/ignored-interceptors.mm`.  When ignore_interceptors_accesses=1, we only check !thr_->is_inited in the constructor of ScopedInterceptor, which then skips ThreadIgnoreBegin, but the destructor still calls ThreadIgnoreEnd:

    ScopedInterceptor::ScopedInterceptor(...) {
      Initialize(thr);
      if (!thr_->is_inited)
        return;
      ...
      if (flags()->ignore_interceptors_accesses) ThreadIgnoreBegin(thr_, pc_);
    }
    ScopedInterceptor::~ScopedInterceptor() {
      if (flags()->ignore_interceptors_accesses) ThreadIgnoreEnd(thr_, pc_);
      ...
    }


http://reviews.llvm.org/D16214

Files:
  lib/tsan/rtl/tsan_interceptors.cc

Index: lib/tsan/rtl/tsan_interceptors.cc
===================================================================
--- lib/tsan/rtl/tsan_interceptors.cc
+++ lib/tsan/rtl/tsan_interceptors.cc
@@ -275,9 +275,7 @@
     , pc_(pc)
     , in_ignored_lib_(false) {
   Initialize(thr);
-  if (!thr_->is_inited)
-    return;
-  if (!thr_->ignore_interceptors)
+  if (thr_->is_inited && !thr_->ignore_interceptors)
     FuncEntry(thr, pc);
   DPrintf("#%d: intercept %s()\n", thr_->tid, fname);
   if (!thr_->in_ignored_lib && libignore()->IsIgnored(pc)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16214.44968.patch
Type: text/x-patch
Size: 541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160115/064a8403/attachment.bin>


More information about the llvm-commits mailing list