#endif
#include "rcu_internal.h"
-#if defined(__clang__) && defined(__has_feature)
-#if __has_feature(thread_sanitizer)
-#define __SANITIZE_THREAD__
-#endif
-#endif
-
#if defined(__SANITIZE_THREAD__)
-#include <sanitizer/tsan_interface.h>
#define TSAN_FAKE_UNLOCK(x) \
__tsan_mutex_pre_unlock((x), 0); \
__tsan_mutex_post_unlock((x), 0)
#ifndef _CRYPTO_THREADS_COMMON_H_
#define _CRYPTO_THREADS_COMMON_H_
+#if defined(__clang__) && defined(__has_feature)
+#if __has_feature(thread_sanitizer)
+#define __SANITIZE_THREAD__
+#endif
+#endif
+
+#if defined(__SANITIZE_THREAD__)
+#include <sanitizer/tsan_interface.h>
+extern void AnnotateBenignRaceSized(const char *f, int l,
+ const volatile void *mem, unsigned int size, const char *desc);
+#define TSAN_BENIGN(x, desc) \
+ AnnotateBenignRaceSized(__FILE__, __LINE__, &(x), sizeof(x), desc);
+#else
+#define TSAN_BENIGN(x, desc)
+#endif
+
typedef enum {
CRYPTO_THREAD_LOCAL_RCU_KEY = 0,
CRYPTO_THREAD_LOCAL_DRBG_PRIV_KEY,
* that this function continues until it obtains a lock in FIPS_deferred()
* and then it will recheck this value and immediately exit.
*/
+
+ TSAN_BENIGN(st_all_tests[id].state, "Fails safe, avoids contention")
if (st_all_tests[id].state == SELF_TEST_STATE_PASSED)
return 1;