aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-04-26 19:24:20 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-04-26 19:24:20 +0000
commit2953104c9a262728031dc518429d15b969dd6028 (patch)
treed4fff23823637f2256cedf634a2be262862ea90f /include
parentf351c8a560ddc5b5df9ee5ba4ccc1cfb9029146d (diff)
downloadsrc-2953104c9a262728031dc518429d15b969dd6028.tar.gz
src-2953104c9a262728031dc518429d15b969dd6028.zip
Vendor import of compiler-rt trunk r301441:vendor/compiler-rt/compiler-rt-trunk-r301441
Notes
Notes: svn path=/vendor/compiler-rt/dist/; revision=317449 svn path=/vendor/compiler-rt/compiler-rt-trunk-r301441/; revision=317450; tag=vendor/compiler-rt/compiler-rt-trunk-r301441
Diffstat (limited to 'include')
-rw-r--r--include/sanitizer/tsan_interface.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/sanitizer/tsan_interface.h b/include/sanitizer/tsan_interface.h
index 34b74d537e0c..45e54f7581a1 100644
--- a/include/sanitizer/tsan_interface.h
+++ b/include/sanitizer/tsan_interface.h
@@ -114,6 +114,21 @@ void __tsan_mutex_post_signal(void *addr, unsigned flags);
void __tsan_mutex_pre_divert(void *addr, unsigned flags);
void __tsan_mutex_post_divert(void *addr, unsigned flags);
+// External race detection API.
+// Can be used by non-instrumented libraries to detect when their objects are
+// being used in an unsafe manner.
+// - __tsan_external_read/__tsan_external_write annotates the logical reads
+// and writes of the object at the specified address. 'caller_pc' should
+// be the PC of the library user, which the library can obtain with e.g.
+// `__builtin_return_address(0)`.
+// - __tsan_external_register_tag registers a 'tag' with the specified name,
+// which is later used in read/write annotations to denote the object type
+// - __tsan_external_assign_tag can optionally mark a heap object with a tag
+void *__tsan_external_register_tag(const char *object_type);
+void __tsan_external_assign_tag(void *addr, void *tag);
+void __tsan_external_read(void *addr, void *caller_pc, void *tag);
+void __tsan_external_write(void *addr, void *caller_pc, void *tag);
+
#ifdef __cplusplus
} // extern "C"
#endif