Don't build test/malloc.cc with TSAN.

Change-Id: I33c5259f066693c912ba751dff0205ae240f4a92
Reviewed-on: https://boringssl-review.googlesource.com/29964
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/crypto/test/malloc.cc b/crypto/test/malloc.cc
index 5f0bc6e..1718939 100644
--- a/crypto/test/malloc.cc
+++ b/crypto/test/malloc.cc
@@ -27,7 +27,7 @@
 // coexist.
 #if defined(__linux__) && defined(OPENSSL_GLIBC) && !defined(OPENSSL_ARM) && \
     !defined(OPENSSL_AARCH64) && !defined(OPENSSL_ASAN) &&                   \
-    !defined(OPENSSL_MSAN)
+    !defined(OPENSSL_MSAN) && !defined(OPENSSL_TSAN)
 
 #include <errno.h>
 #include <signal.h>
@@ -140,4 +140,4 @@
 
 }  // extern "C"
 
-#endif  // defined(linux) && GLIBC && !ARM && !AARCH64 && !ASAN
+#endif  // defined(linux) && GLIBC && !ARM && !AARCH64 && !ASAN && !TSAN
diff --git a/include/openssl/base.h b/include/openssl/base.h
index 9762619..0083a5d 100644
--- a/include/openssl/base.h
+++ b/include/openssl/base.h
@@ -222,6 +222,9 @@
 #if __has_feature(address_sanitizer)
 #define OPENSSL_ASAN
 #endif
+#if __has_feature(thread_sanitizer)
+#define OPENSSL_TSAN
+#endif
 #if __has_feature(memory_sanitizer)
 #define OPENSSL_MSAN
 #endif