diff options
author | Kuba Mracek <mracek@apple.com> | 2017-04-21 17:25:47 +0000 |
---|---|---|
committer | Kuba Mracek <mracek@apple.com> | 2017-04-21 17:25:47 +0000 |
commit | 35ad53db387d998a574dec72ae43d98d677ac616 (patch) | |
tree | b6807337a27178a30fa93cbe0e741000e8cfad04 /include | |
parent | 58a4814ee329cf97331e7af3c3a3a1d6d60fd521 (diff) |
[tsan] Publish the TSan external API in tsan_interface.h
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);
Differential Revision: https://reviews.llvm.org/D32358
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301003 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/sanitizer/tsan_interface.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/sanitizer/tsan_interface.h b/include/sanitizer/tsan_interface.h index 34b74d537..45e54f758 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 |