[PATCH] D119034: [TSan] Handle FreeBSD specific indirection of libpthread functions

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 4 12:56:24 PST 2022


dim created this revision.
dim added reviewers: dvyukov, emaste, krytarowski, vitalybuka.
Herald added a subscriber: arichardson.
dim requested review of this revision.
Herald added a project: Sanitizers.

Similar to 60cc1d3218fc for NetBSD, add aliases and interceptors for the
following pthread related functions:

- pthread_cond_init(3)
- pthread_cond_destroy(3)
- pthread_cond_signal(3)
- pthread_cond_broadcast(3)
- pthread_cond_wait(3)
- pthread_mutex_init(3)
- pthread_mutex_destroy(3)
- pthread_mutex_lock(3)
- pthread_mutex_trylock(3)
- pthread_mutex_unlock(3)
- pthread_rwlock_init(3)
- pthread_rwlock_destroy(3)
- pthread_rwlock_rdlock(3)
- pthread_rwlock_tryrdlock(3)
- pthread_rwlock_wrlock(3)
- pthread_rwlock_trywrlock(3)
- pthread_rwlock_unlock(3)
- pthread_once(3)
- pthread_sigmask(3)

In FreeBSD's libc, a number of internal aliases of the pthread functions
are invoked, typically with an additional prefixed underscore, e.g.
_pthread_cond_init() and so on.

ThreadSanitizer needs to intercept these aliases too, otherwise some
false positive reports about data races might be produced.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119034

Files:
  compiler-rt/lib/tsan/rtl/tsan_interceptors.h
  compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119034.406085.patch
Type: text/x-patch
Size: 5026 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220204/fefe0033/attachment.bin>


More information about the llvm-commits mailing list