[all-commits] [llvm/llvm-project] bb9006: [lldb] Fix data race in ThreadList
Augusto Noronha via All-commits
all-commits at lists.llvm.org
Fri Aug 18 16:55:18 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: bb90063249707e3ae081bfbd8e3512566abb7df6
https://github.com/llvm/llvm-project/commit/bb90063249707e3ae081bfbd8e3512566abb7df6
Author: Augusto Noronha <augusto2112 at me.com>
Date: 2023-08-18 (Fri, 18 Aug 2023)
Changed paths:
M lldb/include/lldb/Target/Process.h
M lldb/include/lldb/Target/ThreadCollection.h
M lldb/include/lldb/Target/ThreadList.h
M lldb/source/Target/Process.cpp
M lldb/source/Target/ThreadList.cpp
Log Message:
-----------
[lldb] Fix data race in ThreadList
ThreadSanitizer reports the following issue:
```
Write of size 8 at 0x00010a70abb0 by thread T3 (mutexes: write M0):
#0 lldb_private::ThreadList::Update(lldb_private::ThreadList&) ThreadList.cpp:741 (liblldb.18.0.0git.dylib:arm64+0x5dedf4) (BuildId: 9bced2aafa373580ae9d750d9cf79a8f32000000200000000100000000000e00)
#1 lldb_private::Process::UpdateThreadListIfNeeded() Process.cpp:1212 (liblldb.18.0.0git.dylib:arm64+0x53bbec) (BuildId: 9bced2aafa373580ae9d750d9cf79a8f32000000200000000100000000000e00)
Previous read of size 8 at 0x00010a70abb0 by main thread (mutexes: write M1):
#0 lldb_private::ThreadList::GetMutex() const ThreadList.cpp:785 (liblldb.18.0.0git.dylib:arm64+0x5df138) (BuildId: 9bced2aafa373580ae9d750d9cf79a8f32000000200000000100000000000e00)
#1 lldb_private::ThreadList::DidResume() ThreadList.cpp:656 (liblldb.18.0.0git.dylib:arm64+0x5de5c0) (BuildId: 9bced2aafa373580ae9d750d9cf79a8f32000000200000000100000000000e00)
#2 lldb_private::Process::PrivateResume() Process.cpp:3130 (liblldb.18.0.0git.dylib:arm64+0x53cd7c) (BuildId: 9bced2aafa373580ae9d750d9cf79a8f32000000200000000100000000000e00)
```
Fix this by only using the mutex in ThreadList and removing the one in
process entirely.
Differential Revision: https://reviews.llvm.org/D158034
More information about the All-commits
mailing list