[compiler-rt] e47c0ef - [TSan] Revert removal of ignore_interceptors_accesses flag

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 12:35:51 PDT 2020


Author: Julian Lettner
Date: 2020-06-08T12:35:43-07:00
New Revision: e47c0ef09f42f632f0838fbf6e56cbf57aa70c92

URL: https://github.com/llvm/llvm-project/commit/e47c0ef09f42f632f0838fbf6e56cbf57aa70c92
DIFF: https://github.com/llvm/llvm-project/commit/e47c0ef09f42f632f0838fbf6e56cbf57aa70c92.diff

LOG: [TSan] Revert removal of ignore_interceptors_accesses flag

This flag suppresses TSan FPs on Darwin.  I removed this flag
prematurely and have been dealing with the fallout ever since.

This commit puts back the flag, reverting 7d1085cb [1].

[1] https://reviews.llvm.org/D55075

Added: 
    

Modified: 
    compiler-rt/lib/tsan/rtl/tsan_flags.inc
    compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
    compiler-rt/test/sanitizer_common/TestCases/Darwin/abort_on_error.cpp
    compiler-rt/test/sanitizer_common/lit.common.cfg.py
    compiler-rt/test/tsan/Darwin/norace-objcxx-run-time.mm
    compiler-rt/test/tsan/Unit/lit.site.cfg.py.in
    compiler-rt/test/tsan/lit.cfg.py

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_flags.inc b/compiler-rt/lib/tsan/rtl/tsan_flags.inc
index bfb74b696e67..2105c754486f 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_flags.inc
+++ b/compiler-rt/lib/tsan/rtl/tsan_flags.inc
@@ -76,6 +76,8 @@ TSAN_FLAG(int, io_sync, 1,
 TSAN_FLAG(bool, die_after_fork, true,
           "Die after multi-threaded fork if the child creates new threads.")
 TSAN_FLAG(const char *, suppressions, "", "Suppressions file name.")
+TSAN_FLAG(bool, ignore_interceptors_accesses, SANITIZER_MAC ? true : false,
+          "Ignore reads and writes from all interceptors.")
 TSAN_FLAG(bool, ignore_noninstrumented_modules, SANITIZER_MAC ? true : false,
           "Interceptors should only detect races when called from instrumented "
           "modules.")

diff  --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
index 718957c37031..9c3e0369bc6c 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
@@ -254,7 +254,8 @@ ScopedInterceptor::ScopedInterceptor(ThreadState *thr, const char *fname,
   if (!thr_->ignore_interceptors) FuncEntry(thr, pc);
   DPrintf("#%d: intercept %s()\n", thr_->tid, fname);
   ignoring_ =
-      !thr_->in_ignored_lib && libignore()->IsIgnored(pc, &in_ignored_lib_);
+      !thr_->in_ignored_lib && (flags()->ignore_interceptors_accesses ||
+                                libignore()->IsIgnored(pc, &in_ignored_lib_));
   EnableIgnores();
 }
 

diff  --git a/compiler-rt/test/sanitizer_common/TestCases/Darwin/abort_on_error.cpp b/compiler-rt/test/sanitizer_common/TestCases/Darwin/abort_on_error.cpp
index aa3e1dbd9edd..a7bd7174a455 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Darwin/abort_on_error.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Darwin/abort_on_error.cpp
@@ -4,7 +4,7 @@
 // RUN: %clangxx -DUSING_%tool_name %s -o %t
 
 // Intentionally don't inherit the default options.
-// RUN: env %tool_options='' not --crash %run %t 2>&1
+// RUN: env %tool_options='' TSAN_OPTIONS=ignore_interceptors_accesses=0 not --crash %run %t 2>&1
 
 // When we use lit's default options, we shouldn't crash.
 // RUN: not %run %t 2>&1

diff  --git a/compiler-rt/test/sanitizer_common/lit.common.cfg.py b/compiler-rt/test/sanitizer_common/lit.common.cfg.py
index a587daa6fbde..ac99c0d2d1c6 100644
--- a/compiler-rt/test/sanitizer_common/lit.common.cfg.py
+++ b/compiler-rt/test/sanitizer_common/lit.common.cfg.py
@@ -35,6 +35,8 @@
   # On Darwin, we default to `abort_on_error=1`, which would make tests run
   # much slower. Let's override this and run lit tests with 'abort_on_error=0'.
   default_tool_options += ['abort_on_error=0']
+  if config.tool_name == "tsan":
+    default_tool_options += ['ignore_interceptors_accesses=0']
 elif config.android:
   # The same as on Darwin, we default to "abort_on_error=1" which slows down
   # testing. Also, all existing tests are using "not" instead of "not --crash"

diff  --git a/compiler-rt/test/tsan/Darwin/norace-objcxx-run-time.mm b/compiler-rt/test/tsan/Darwin/norace-objcxx-run-time.mm
index ee76ec155cb4..b6a38d702240 100644
--- a/compiler-rt/test/tsan/Darwin/norace-objcxx-run-time.mm
+++ b/compiler-rt/test/tsan/Darwin/norace-objcxx-run-time.mm
@@ -1,5 +1,5 @@
 // RUN: %clang_tsan %s -lc++ -fobjc-arc -lobjc -o %t -framework Foundation %darwin_min_target_with_full_runtime_arc_support
-// RUN: %run %t 2>&1 | FileCheck %s
+// RUN: %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1 | FileCheck %s
 
 // Check that we do not report races between:
 // - Object retain and initialize

diff  --git a/compiler-rt/test/tsan/Unit/lit.site.cfg.py.in b/compiler-rt/test/tsan/Unit/lit.site.cfg.py.in
index b9307b52f9e5..714501a0d76d 100644
--- a/compiler-rt/test/tsan/Unit/lit.site.cfg.py.in
+++ b/compiler-rt/test/tsan/Unit/lit.site.cfg.py.in
@@ -21,3 +21,4 @@ if config.host_os == 'Darwin':
     config.environment['TSAN_OPTIONS'] += ':ignore_noninstrumented_modules=0'
   else:
     config.environment['TSAN_OPTIONS'] = 'ignore_noninstrumented_modules=0'
+  config.environment['TSAN_OPTIONS'] += ':ignore_interceptors_accesses=0'

diff  --git a/compiler-rt/test/tsan/lit.cfg.py b/compiler-rt/test/tsan/lit.cfg.py
index 9ef1068fb35a..4295514f0a5e 100644
--- a/compiler-rt/test/tsan/lit.cfg.py
+++ b/compiler-rt/test/tsan/lit.cfg.py
@@ -28,6 +28,7 @@ def get_required_attr(config, attr_name):
   # suppresses some races the tests are supposed to find. Let's run without this
   # setting, but turn it back on for Darwin tests (see Darwin/lit.local.cfg.py).
   default_tsan_opts += ':ignore_noninstrumented_modules=0'
+  default_tsan_opts += ':ignore_interceptors_accesses=0'
 
 # Platform-specific default TSAN_OPTIONS for lit tests.
 if default_tsan_opts:


        


More information about the llvm-commits mailing list