diff options
author | Kostya Serebryany <kcc@google.com> | 2018-09-05 01:29:08 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2018-09-05 01:29:08 +0000 |
commit | b453ba0c666212c376d2548f2cbb33b2f8e86e0c (patch) | |
tree | 9324c91d77bf7ea0824887aaaae2c01a2b4c6f4e /lib/hwasan | |
parent | 4a25392c933e8d054d1248d26717c63b8f1202a4 (diff) | |
download | compiler-rt-b453ba0c666212c376d2548f2cbb33b2f8e86e0c.tar.gz |
[hwasan] revert r341435 as it breaks the bot on aarch64
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341441 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/hwasan')
-rw-r--r-- | lib/hwasan/hwasan_linux.cc | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/hwasan/hwasan_linux.cc b/lib/hwasan/hwasan_linux.cc index 36ebc9b52..3285431eb 100644 --- a/lib/hwasan/hwasan_linux.cc +++ b/lib/hwasan/hwasan_linux.cc @@ -221,25 +221,23 @@ extern "C" void __hwasan_thread_exit() { Thread *t = GetCurrentThread(); // Make sure that signal handler can not see a stale current thread pointer. atomic_signal_fence(memory_order_seq_cst); - CHECK(t); - t->Destroy(); + if (t) + t->Destroy(); } #if HWASAN_WITH_INTERCEPTORS static pthread_key_t tsd_key; static bool tsd_key_inited = false; -static THREADLOCAL Thread *current_thread; - void HwasanTSDDtor(void *tsd) { - Thread *t = current_thread; + Thread *t = (Thread*)tsd; if (t->destructor_iterations_ > 1) { t->destructor_iterations_--; - CHECK_EQ(0, pthread_setspecific(tsd_key, (void*)1)); + CHECK_EQ(0, pthread_setspecific(tsd_key, tsd)); return; } + t->Destroy(); __hwasan_thread_exit(); - current_thread = nullptr; } void HwasanTSDInit() { @@ -249,17 +247,15 @@ void HwasanTSDInit() { } Thread *GetCurrentThread() { - return current_thread; + return (Thread *)pthread_getspecific(tsd_key); } void SetCurrentThread(Thread *t) { // Make sure that HwasanTSDDtor gets called at the end. CHECK(tsd_key_inited); // Make sure we do not reset the current Thread. - CHECK_EQ(current_thread, nullptr); - current_thread = t; CHECK_EQ(0, pthread_getspecific(tsd_key)); - CHECK_EQ(0, pthread_setspecific(tsd_key, (void *)1)); + pthread_setspecific(tsd_key, (void *)t); } #elif SANITIZER_ANDROID void HwasanTSDInit() {} |