[compiler-rt] r350445 - Bring back the pthread_create interceptor, but only on non-aarch64.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 4 15:24:02 PST 2019


Author: pcc
Date: Fri Jan  4 15:24:02 2019
New Revision: 350445

URL: http://llvm.org/viewvc/llvm-project?rev=350445&view=rev
Log:
Bring back the pthread_create interceptor, but only on non-aarch64.

We still need the interceptor on non-aarch64 to untag the pthread_t
and pthread_attr_t pointers and disable tagging on allocations done
internally by glibc.

Modified:
    compiler-rt/trunk/lib/hwasan/hwasan_interceptors.cc

Modified: compiler-rt/trunk/lib/hwasan/hwasan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/hwasan/hwasan_interceptors.cc?rev=350445&r1=350444&r2=350445&view=diff
==============================================================================
--- compiler-rt/trunk/lib/hwasan/hwasan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/hwasan/hwasan_interceptors.cc Fri Jan  4 15:24:02 2019
@@ -217,6 +217,17 @@ INTERCEPTOR_ALIAS(void, malloc_stats, vo
 #endif
 #endif // HWASAN_WITH_INTERCEPTORS
 
+
+#if HWASAN_WITH_INTERCEPTORS && !defined(__aarch64__)
+INTERCEPTOR(int, pthread_create, void *th, void *attr,
+            void *(*callback)(void *), void *param) {
+  ScopedTaggingDisabler disabler;
+  int res = REAL(pthread_create)(UntagPtr(th), UntagPtr(attr),
+                                 callback, param);
+  return res;
+}
+#endif
+
 static void BeforeFork() {
   StackDepotLockAll();
 }
@@ -256,6 +267,9 @@ void InitializeInterceptors() {
   INTERCEPT_FUNCTION(fork);
 
 #if HWASAN_WITH_INTERCEPTORS
+#if !defined(__aarch64__)
+  INTERCEPT_FUNCTION(pthread_create);
+#endif
   INTERCEPT_FUNCTION(realloc);
   INTERCEPT_FUNCTION(free);
 #endif




More information about the llvm-commits mailing list