diff options
| author | Kostya Serebryany <kcc@google.com> | 2015-09-01 21:36:18 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2015-09-01 21:36:18 +0000 |
| commit | 94dd76aefa00bd2b3b4981695f6f962600c1c829 (patch) | |
| tree | ae21602cf2accfaf6ba65e81d1276d5c6fe7e579 | |
| parent | b8ed364d8a64e71520c07a095d1c6a6e8fbce1dd (diff) | |
| download | bcm5719-llvm-94dd76aefa00bd2b3b4981695f6f962600c1c829.tar.gz bcm5719-llvm-94dd76aefa00bd2b3b4981695f6f962600c1c829.zip | |
[tsan] workaround for a crash in deadlock detector, bug https://github.com/google/sanitizers/issues/594
llvm-svn: 246592
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc | 2 | ||||
| -rw-r--r-- | compiler-rt/test/tsan/deadlock_detector_stress_test.cc | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc index 09180d88a6f..62ab7aa6b2b 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc @@ -472,7 +472,7 @@ void ReportDeadlock(ThreadState *thr, uptr pc, DDReport *r) { for (int i = 0; i < r->n; i++) { for (int j = 0; j < (flags()->second_deadlock_stack ? 2 : 1); j++) { u32 stk = r->loop[i].stk[j]; - if (stk) { + if (stk && stk != 0xffffffff) { rep.AddStack(StackDepotGet(stk), true); } else { // Sometimes we fail to extract the stack trace (FIXME: investigate), diff --git a/compiler-rt/test/tsan/deadlock_detector_stress_test.cc b/compiler-rt/test/tsan/deadlock_detector_stress_test.cc index c77ffe555ce..efc13ae2624 100644 --- a/compiler-rt/test/tsan/deadlock_detector_stress_test.cc +++ b/compiler-rt/test/tsan/deadlock_detector_stress_test.cc @@ -498,6 +498,19 @@ class LockTest { delete [] l; } + void Test19() { + if (test_number > 0 && test_number != 19) return; + fprintf(stderr, "Starting Test19: lots of lock inversions\n"); + const int kNumLocks = 45; + Init(kNumLocks); + for (int i = 0; i < kNumLocks; i++) { + for (int j = 0; j < kNumLocks; j++) + L((i + j) % kNumLocks); + for (int j = 0; j < kNumLocks; j++) + U((i + j) % kNumLocks); + } + } + private: void Lock2(size_t l1, size_t l2) { L(l1); L(l2); U(l2); U(l1); } @@ -602,6 +615,7 @@ int main(int argc, char **argv) { LockTest().Test16(); LockTest().Test17(); LockTest().Test18(); + LockTest().Test19(); fprintf(stderr, "ALL-DONE\n"); // CHECK: ALL-DONE } |

