[libcxx-commits] [PATCH] D64299: Make ~mutex and ~condition_variable trivial with Bionic pthreads

Dmitry Vyukov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 17 00:19:49 PDT 2019


dvyukov added a comment.

In D64299#1588251 <https://reviews.llvm.org/D64299#1588251>, @eugenis wrote:

> This feels like the right trade-off.
>
> TSan should be fine with a mutex that is never destroyed, but it will not be able to catch lock-after-destroy bugs on such mutex obviously.
>  @dvyukov


Effectively pthread_mutex_destroy is not trivial under tsan so, yes, there will be a number of negative consequences:

- no lock-after-destroy races
- no races between lock/unlock and a subsequent destory
- no racy use-after-free detection for destroy vs free
- incorrect stack trace for a mutex that happened to reuse the address later
- resource leaks for mutexes
- no reporting of unlock of locked mutex
- no auto-unlock for destroyed mutexes, which will look like the thread is taking infinite number of locks recursively, which will quickly check-fail in deadlock detector


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64299/new/

https://reviews.llvm.org/D64299





More information about the libcxx-commits mailing list