[compiler-rt] r233378 - [Tsan] Do not sanitize memset() and other functions during initialization
Viktor Kutuzov
vkutuzov at accesssoftek.com
Fri Mar 27 07:12:29 PDT 2015
Author: vkutuzov
Date: Fri Mar 27 09:12:28 2015
New Revision: 233378
URL: http://llvm.org/viewvc/llvm-project?rev=233378&view=rev
Log:
[Tsan] Do not sanitize memset() and other functions during initialization
Differential Revision: http://reviews.llvm.org/D8544
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=233378&r1=233377&r2=233378&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Fri Mar 27 09:12:28 2015
@@ -156,6 +156,9 @@ const int SA_SIGINFO = 4;
const int SIG_SETMASK = 2;
#endif
+#define COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED \
+ (!cur_thread()->is_inited)
+
namespace std {
struct nothrow_t {};
} // namespace std
@@ -663,14 +666,17 @@ TSAN_INTERCEPTOR(uptr, strlen, const cha
}
TSAN_INTERCEPTOR(void*, memset, void *dst, int v, uptr size) {
- SCOPED_TSAN_INTERCEPTOR(memset, dst, v, size);
- MemoryAccessRange(thr, pc, (uptr)dst, size, true);
+ // On FreeBSD we get here from libthr internals on thread initialization.
+ if (!COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED) {
+ SCOPED_TSAN_INTERCEPTOR(memset, dst, v, size);
+ MemoryAccessRange(thr, pc, (uptr)dst, size, true);
+ }
return internal_memset(dst, v, size);
}
TSAN_INTERCEPTOR(void*, memcpy, void *dst, const void *src, uptr size) {
// On FreeBSD we get here from libthr internals on thread initialization.
- if (cur_thread()->is_inited) {
+ if (!COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED) {
SCOPED_TSAN_INTERCEPTOR(memcpy, dst, src, size);
MemoryAccessRange(thr, pc, (uptr)dst, size, true);
MemoryAccessRange(thr, pc, (uptr)src, size, false);
More information about the llvm-commits
mailing list