[PATCH] D65705: [TSAN] Fix tsan on FreeBSD after D54889

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 3 15:02:36 PDT 2019


arichardson created this revision.
arichardson added reviewers: yuri, dvyukov, dim, emaste.
Herald added subscribers: llvm-commits, Sanitizers, krytarowski, kubamracek.
Herald added projects: Sanitizers, LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65705

Files:
  compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
  compiler-rt/test/tsan/ignored-interceptors-mmap.cpp


Index: compiler-rt/test/tsan/ignored-interceptors-mmap.cpp
===================================================================
--- compiler-rt/test/tsan/ignored-interceptors-mmap.cpp
+++ 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>
Index: compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
===================================================================
--- compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
+++ compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
@@ -149,6 +149,7 @@
   // 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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65705.213208.patch
Type: text/x-patch
Size: 1022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190803/121ab75e/attachment.bin>


More information about the llvm-commits mailing list