[compiler-rt] 5c27740 - [asan] Run background thread for asan only on THUMB
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 8 12:44:12 PST 2021
Author: Vitaly Buka
Date: 2021-12-08T12:43:56-08:00
New Revision: 5c27740238007d22f2d0cd0ebe2aaffa90a9c92b
URL: https://github.com/llvm/llvm-project/commit/5c27740238007d22f2d0cd0ebe2aaffa90a9c92b
DIFF: https://github.com/llvm/llvm-project/commit/5c27740238007d22f2d0cd0ebe2aaffa90a9c92b.diff
LOG: [asan] Run background thread for asan only on THUMB
As in D114934, or lsan crashes on the same bot.
Added:
Modified:
compiler-rt/lib/asan/asan_rtl.cpp
compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/asan/asan_rtl.cpp b/compiler-rt/lib/asan/asan_rtl.cpp
index 35b785a79e3e..f0bbbf32e6a6 100644
--- a/compiler-rt/lib/asan/asan_rtl.cpp
+++ b/compiler-rt/lib/asan/asan_rtl.cpp
@@ -445,6 +445,9 @@ static void AsanInitInternal() {
allocator_options.SetFrom(flags(), common_flags());
InitializeAllocator(allocator_options);
+ if (SANITIZER_START_BACKGROUND_THREAD_IN_ASAN_INTERNAL)
+ MaybeStartBackgroudThread();
+
// On Linux AsanThread::ThreadStart() calls malloc() that's why asan_inited
// should be set to 1 prior to initializing the threads.
asan_inited = 1;
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
index fd54357adbe4..c5a5fb7371dd 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
@@ -189,8 +189,6 @@ bool AllocatorMayReturnNull() {
void SetAllocatorMayReturnNull(bool may_return_null) {
atomic_store(&allocator_may_return_null, may_return_null,
memory_order_relaxed);
- if (SANITIZER_START_BACKGROUND_THREAD_IN_ASAN_INTERNAL)
- MaybeStartBackgroudThread();
}
void PrintHintAllocatorCannotReturnNull() {
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
index 13624a83865d..271d733be6b0 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
@@ -107,6 +107,8 @@ static struct BackgroudThreadStarted {
} background_thread_strarter UNUSED;
# pragma clang diagnostic pop
# endif
+#else
+void MaybeStartBackgroudThread() {}
#endif
void WriteToSyslog(const char *msg) {
More information about the llvm-commits
mailing list