summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Richardson <arichardson.kde@gmail.com>2019-08-06 22:30:48 +0000
committerAlexander Richardson <arichardson.kde@gmail.com>2019-08-06 22:30:48 +0000
commit0b168ffdc3fff3f88edaaa7de7444c119cbbdfc2 (patch)
tree682efeadabc6c079ac1f806282c059138ba1cd05
parent0930643ff6f1684bf234a97f6a3b76bf8e30b0a1 (diff)
downloadbcm5719-llvm-0b168ffdc3fff3f88edaaa7de7444c119cbbdfc2.tar.gz
bcm5719-llvm-0b168ffdc3fff3f88edaaa7de7444c119cbbdfc2.zip
[TSAN] Fix tsan on FreeBSD after D54889
Summary: It appears that since https://reviews.llvm.org/D54889, BackgroundThread() crashes immediately because cur_thread()-> will return a null pointer which is then dereferenced. I'm not sure why I only see this issue on FreeBSD and not Linux since it should also be unintialized on other platforms. Reviewers: yuri, dvyukov, dim, emaste Subscribers: kubamracek, krytarowski, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D65705 llvm-svn: 368103
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_rtl.cpp1
-rw-r--r--compiler-rt/test/tsan/ignored-interceptors-mmap.cpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
index 312d00c6f92..1ac3907094b 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
@@ -149,6 +149,7 @@ static void BackgroundThread(void *arg) {
// We don't use ScopedIgnoreInterceptors, because we want ignores to be
// enabled even when the thread function exits (e.g. during pthread thread
// shutdown code).
+ cur_thread_init();
cur_thread()->ignore_interceptors++;
const u64 kMs2Ns = 1000 * 1000;
diff --git a/compiler-rt/test/tsan/ignored-interceptors-mmap.cpp b/compiler-rt/test/tsan/ignored-interceptors-mmap.cpp
index bb43250a659..bcfafa40991 100644
--- a/compiler-rt/test/tsan/ignored-interceptors-mmap.cpp
+++ b/compiler-rt/test/tsan/ignored-interceptors-mmap.cpp
@@ -1,7 +1,7 @@
// RUN: %clangxx_tsan -O0 %s -o %t
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-RACE
// RUN: %run %t ignore 2>&1 | FileCheck %s --check-prefix=CHECK-IGNORE
-// XFAIL: freebsd,netbsd
+// XFAIL: netbsd
#include <sys/mman.h>
#include <string.h>
OpenPOWER on IntegriCloud