[PATCH] D40767: Support pthread_key_create symbol alias in MSan/NetBSD

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 2 05:39:55 PST 2017


krytarowski created this revision.
krytarowski added a project: Sanitizers.

NetBSD uses indirection symbol for a set of threading functions.

Add alias to handle __libc_thr_keycreate the same way as pthread_key_create.

Sponsored by <The NetBSD Foundation>


Repository:
  rL LLVM

https://reviews.llvm.org/D40767

Files:
  lib/msan/msan_interceptors.cc


Index: lib/msan/msan_interceptors.cc
===================================================================
--- lib/msan/msan_interceptors.cc
+++ lib/msan/msan_interceptors.cc
@@ -1484,6 +1484,11 @@
   __msan_unpoison(s, REAL(strlen)(s) + 1);
 }
 
+#if SANITIZER_NETBSD
+INTERCEPTOR(void, __libc_thr_keycreate, void *m) \
+  ALIAS(WRAPPER_NAME(pthread_key_create));
+#endif
+
 namespace __msan {
 
 void InitializeInterceptors() {
@@ -1604,6 +1609,10 @@
   INTERCEPT_FUNCTION(openpty);
   INTERCEPT_FUNCTION(forkpty);
 
+#if SANITIZER_NETBSD
+  INTERCEPT_FUNCTION(__libc_thr_keycreate);
+#endif
+
   inited = 1;
 }
 } // namespace __msan


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40767.125264.patch
Type: text/x-patch
Size: 635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171202/f98eaf6e/attachment.bin>


More information about the llvm-commits mailing list