[compiler-rt] r368103 - [TSAN] Fix tsan on FreeBSD after D54889
Alexander Richardson via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 6 15:30:49 PDT 2019
Author: arichardson
Date: Tue Aug 6 15:30:48 2019
New Revision: 368103
URL: http://llvm.org/viewvc/llvm-project?rev=368103&view=rev
Log:
[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
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cpp
compiler-rt/trunk/test/tsan/ignored-interceptors-mmap.cpp
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cpp?rev=368103&r1=368102&r2=368103&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cpp (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cpp Tue Aug 6 15:30:48 2019
@@ -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;
Modified: compiler-rt/trunk/test/tsan/ignored-interceptors-mmap.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/ignored-interceptors-mmap.cpp?rev=368103&r1=368102&r2=368103&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/ignored-interceptors-mmap.cpp (original)
+++ compiler-rt/trunk/test/tsan/ignored-interceptors-mmap.cpp Tue Aug 6 15:30:48 2019
@@ -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>
More information about the llvm-commits
mailing list