[PATCH] D55846: [TSan] Align default value of `detect_deadlock` flag with actual beh

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 18 12:01:41 PST 2018


yln created this revision.
Herald added subscribers: Sanitizers, llvm-commits, kubamracek.

Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D55846

Files:
  compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
  compiler-rt/lib/tsan/rtl/tsan_flags.cc
  compiler-rt/test/tsan/deadlock_detector_stress_test.cc
  compiler-rt/test/tsan/mutex_cycle2.c


Index: compiler-rt/test/tsan/mutex_cycle2.c
===================================================================
--- compiler-rt/test/tsan/mutex_cycle2.c
+++ compiler-rt/test/tsan/mutex_cycle2.c
@@ -1,5 +1,5 @@
 // RUN: %clangxx_tsan %s -o %t
-// RUN:                                 not %run %t 2>&1 | FileCheck %s
+// RUN:                                   not %run %t 2>&1 | FileCheck %s
 // RUN: %env_tsan_opts=detect_deadlocks=1 not %run %t 2>&1 | FileCheck %s
 // RUN: %env_tsan_opts=detect_deadlocks=0     %run %t 2>&1 | FileCheck %s --check-prefix=DISABLED
 // RUN: echo "deadlock:main" > %t.supp
Index: compiler-rt/test/tsan/deadlock_detector_stress_test.cc
===================================================================
--- compiler-rt/test/tsan/deadlock_detector_stress_test.cc
+++ compiler-rt/test/tsan/deadlock_detector_stress_test.cc
@@ -1,12 +1,12 @@
 // RUN: %clangxx_tsan %s -o %t -DLockType=PthreadMutex
-// RUN: %env_tsan_opts=detect_deadlocks=1 %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOT-SECOND
-// RUN: %env_tsan_opts=detect_deadlocks=1:second_deadlock_stack=1 %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-SECOND
+// RUN: %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOT-SECOND
+// RUN: %env_tsan_opts=second_deadlock_stack=1 %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-SECOND
 // RUN: %clangxx_tsan %s -o %t -DLockType=PthreadSpinLock
-// RUN: %env_tsan_opts=detect_deadlocks=1 %deflake %run %t | FileCheck %s
+// RUN: %deflake %run %t | FileCheck %s
 // RUN: %clangxx_tsan %s -o %t -DLockType=PthreadRWLock
-// RUN: %env_tsan_opts=detect_deadlocks=1 %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-RD
+// RUN: %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-RD
 // RUN: %clangxx_tsan %s -o %t -DLockType=PthreadRecursiveMutex
-// RUN: %env_tsan_opts=detect_deadlocks=1 %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-REC
+// RUN: %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-REC
 #include "test.h"
 #undef NDEBUG
 #include <assert.h>
Index: compiler-rt/lib/tsan/rtl/tsan_flags.cc
===================================================================
--- compiler-rt/lib/tsan/rtl/tsan_flags.cc
+++ compiler-rt/lib/tsan/rtl/tsan_flags.cc
@@ -61,8 +61,7 @@
       // Does not work as expected for Go: runtime handles SIGABRT and crashes.
       cf.abort_on_error = false;
       // Go does not have mutexes.
-    } else {
-      cf.detect_deadlocks = true;
+      cf.detect_deadlocks = false;
     }
     cf.print_suppressions = false;
     cf.stack_trace_format = "    #%n %f %S %M";
Index: compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
+++ compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
@@ -103,7 +103,7 @@
             "handle_*=1 will be upgraded to handle_*=2.")
 COMMON_FLAG(bool, use_sigaltstack, true,
             "If set, uses alternate stack for signal handling.")
-COMMON_FLAG(bool, detect_deadlocks, false,
+COMMON_FLAG(bool, detect_deadlocks, true,
             "If set, deadlock detection is enabled.")
 COMMON_FLAG(
     uptr, clear_shadow_mmap_threshold, 64 * 1024,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55846.178749.patch
Type: text/x-patch
Size: 3373 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181218/19b210a0/attachment.bin>


More information about the llvm-commits mailing list