[PATCH] D32358: [tsan] Publish the TSan external API in tsan_interface.h
Kuba (Brecka) Mracek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 21 10:22:27 PDT 2017
kubamracek created this revision.
kubamracek added a project: Sanitizers.
Let's make the TSan external API available and commented in the public header:
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);
Repository:
rL LLVM
https://reviews.llvm.org/D32358
Files:
include/sanitizer/tsan_interface.h
Index: include/sanitizer/tsan_interface.h
===================================================================
--- include/sanitizer/tsan_interface.h
+++ include/sanitizer/tsan_interface.h
@@ -114,6 +114,21 @@
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32358.96168.patch
Type: text/x-patch
Size: 1304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170421/7812f213/attachment.bin>
More information about the llvm-commits
mailing list