[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
This commit is contained in:
parent
0930643ff6
commit
0b168ffdc3
|
@ -149,6 +149,7 @@ static void BackgroundThread(void *arg) {
|
||||||
// We don't use ScopedIgnoreInterceptors, because we want ignores to be
|
// We don't use ScopedIgnoreInterceptors, because we want ignores to be
|
||||||
// enabled even when the thread function exits (e.g. during pthread thread
|
// enabled even when the thread function exits (e.g. during pthread thread
|
||||||
// shutdown code).
|
// shutdown code).
|
||||||
|
cur_thread_init();
|
||||||
cur_thread()->ignore_interceptors++;
|
cur_thread()->ignore_interceptors++;
|
||||||
const u64 kMs2Ns = 1000 * 1000;
|
const u64 kMs2Ns = 1000 * 1000;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// RUN: %clangxx_tsan -O0 %s -o %t
|
// RUN: %clangxx_tsan -O0 %s -o %t
|
||||||
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-RACE
|
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-RACE
|
||||||
// RUN: %run %t ignore 2>&1 | FileCheck %s --check-prefix=CHECK-IGNORE
|
// RUN: %run %t ignore 2>&1 | FileCheck %s --check-prefix=CHECK-IGNORE
|
||||||
// XFAIL: freebsd,netbsd
|
// XFAIL: netbsd
|
||||||
|
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
Loading…
Reference in New Issue