diff options
Diffstat (limited to 'compiler-rt')
| -rw-r--r-- | compiler-rt/lib/msan/msan_interceptors.cc | 9 | ||||
| -rw-r--r-- | compiler-rt/lib/msan/tests/msan_test.cc | 3 |
2 files changed, 10 insertions, 2 deletions
diff --git a/compiler-rt/lib/msan/msan_interceptors.cc b/compiler-rt/lib/msan/msan_interceptors.cc index ef706e69b1f..cc055b2501d 100644 --- a/compiler-rt/lib/msan/msan_interceptors.cc +++ b/compiler-rt/lib/msan/msan_interceptors.cc @@ -980,6 +980,14 @@ INTERCEPTOR(int, pthread_key_create, __sanitizer_pthread_key_t *key, 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 diff --git a/compiler-rt/lib/msan/tests/msan_test.cc b/compiler-rt/lib/msan/tests/msan_test.cc index 1890db2b991..09000343b16 100644 --- a/compiler-rt/lib/msan/tests/msan_test.cc +++ b/compiler-rt/lib/msan/tests/msan_test.cc @@ -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; } |

