diff options
author | Vitaly Buka <vitalybuka@google.com> | 2024-06-25 08:17:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-25 08:17:10 -0700 |
commit | 7f10ed637e53c68ce62b756a3be8546a3dccf751 (patch) | |
tree | fcad85e7af8593fdce8ece19d2ec22ad75bd6e9f /libcxx/src/filesystem/operations.cpp | |
parent | 79e8a5952366eacd92201a8d6472726fc14e00fd (diff) | |
download | llvm-7f10ed637e53c68ce62b756a3be8546a3dccf751.zip llvm-7f10ed637e53c68ce62b756a3be8546a3dccf751.tar.gz llvm-7f10ed637e53c68ce62b756a3be8546a3dccf751.tar.bz2 |
[tsan] Fix dead lock when starting StackDepot thread (#96456)
Sometime tsan runtimes calls, like
`__tsan_mutex_create ()`, need to store a stack
in the StackDepot, and the Depot may need to start
and maintenance thread.
Example:
```
__sanitizer::FutexWait ()
__sanitizer::Semaphore::Wait ()
__sanitizer::Mutex::Lock ()
__tsan::SlotLock ()
__tsan::SlotLocker::SlotLocker ()
__tsan::Acquire ()
__tsan::CallUserSignalHandler ()
__tsan::ProcessPendingSignalsImpl ()
__tsan::ProcessPendingSignals ()
__tsan::ScopedInterceptor::~ScopedInterceptor ()
___interceptor_mmap ()
pthread_create ()
__sanitizer::internal_start_thread ()
__sanitizer::(anonymous namespace)::CompressThread::NewWorkNotify ()
__sanitizer::StackDepotNode::store ()
__sanitizer::StackDepotBase<__sanitizer::StackDepotNode, 1, 20>::Put ()
__tsan::CurrentStackId ()
__tsan::MutexCreate ()
__tsan_mutex_create ()
```
pthread_create() implementation may hit other
interceptors recursively, which may invoke
ProcessPendingSignals, which deadlocks.
Alternative solution could be block interceptors
closer to TSAN runtime API function, like
`__tsan_mutex_create`, or just before
`StackDepotPut``, but it's not needed for most
calls, only when new thread is created using
`real_pthread_create`.
I don't see a reasonable way to create a
regression test.
Diffstat (limited to 'libcxx/src/filesystem/operations.cpp')
0 files changed, 0 insertions, 0 deletions