[compiler-rt] r187413 - [msan] Intercept pthread_join.
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Tue Jul 30 05:54:34 PDT 2013
Author: eugenis
Date: Tue Jul 30 07:54:34 2013
New Revision: 187413
URL: http://llvm.org/viewvc/llvm-project?rev=187413&view=rev
Log:
[msan] Intercept pthread_join.
Modified:
compiler-rt/trunk/lib/msan/msan_interceptors.cc
compiler-rt/trunk/lib/msan/tests/msan_test.cc
Modified: compiler-rt/trunk/lib/msan/msan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_interceptors.cc?rev=187413&r1=187412&r2=187413&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_interceptors.cc Tue Jul 30 07:54:34 2013
@@ -980,6 +980,14 @@ INTERCEPTOR(int, pthread_key_create, __s
return res;
}
+INTERCEPTOR(int, pthread_join, void *th, void **retval) {
+ ENSURE_MSAN_INITED();
+ int res = REAL(pthread_join)(th, retval);
+ if (!res && retval)
+ __msan_unpoison(retval, sizeof(*retval));
+ return res;
+}
+
struct MSanInterceptorContext {
bool in_interceptor_scope;
};
@@ -1223,6 +1231,7 @@ void InitializeInterceptors() {
INTERCEPT_FUNCTION(signal);
INTERCEPT_FUNCTION(pthread_create);
INTERCEPT_FUNCTION(pthread_key_create);
+ INTERCEPT_FUNCTION(pthread_join);
inited = 1;
}
} // namespace __msan
Modified: compiler-rt/trunk/lib/msan/tests/msan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/msan_test.cc?rev=187413&r1=187412&r2=187413&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/tests/msan_test.cc (original)
+++ compiler-rt/trunk/lib/msan/tests/msan_test.cc Tue Jul 30 07:54:34 2013
@@ -2059,8 +2059,7 @@ TEST(MemorySanitizer, SimpleThread) {
EXPECT_NOT_POISONED(t);
res = pthread_join(t, &p);
assert(!res);
- if (!__msan_has_dynamic_component()) // FIXME: intercept pthread_join (?).
- __msan_unpoison(&p, sizeof(p));
+ EXPECT_NOT_POISONED(p);
delete (int*)p;
}
More information about the llvm-commits
mailing list