diff options
author | Pavel Labath <pavel@labath.sk> | 2024-07-11 14:04:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-11 14:04:19 +0200 |
commit | e1bd337865fca9f455225ba37b76595d37bad213 (patch) | |
tree | 9148a915a04dca6a624f1b4cd75a56a56661b05d /lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp | |
parent | eb977399de30a166e3b1db905950c913fe36730b (diff) | |
download | llvm-e1bd337865fca9f455225ba37b76595d37bad213.zip llvm-e1bd337865fca9f455225ba37b76595d37bad213.tar.gz llvm-e1bd337865fca9f455225ba37b76595d37bad213.tar.bz2 |
[lldb] Fix ThreadList assignment race (#98293)
ThreadList uses the Process mutex to guard its state. This means its not
possible to safely modify its process member, as the member is required
to lock the mutex.
Fortunately for us, we never actually need to change the process member
(we always just juggle different kinds of thread lists belonging to the
same process).
This patch replaces the process member assignment (which is technically
a race even when it assigns the same value) with an assertion.
Since all this means that the class can never change its process member
value (and it also must be non-null at all times), I've also changed the
member type to a reference.
Diffstat (limited to 'lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp')
-rw-r--r-- | lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index 81ee7e3..e026ffe 100644 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -372,7 +372,7 @@ lldb::ThreadSP OperatingSystemPython::CreateThread(lldb::tid_t tid, std::vector<bool> core_used_map; if (thread_info_dict) { - ThreadList core_threads(m_process); + ThreadList core_threads(*m_process); ThreadList &thread_list = m_process->GetThreadList(); bool did_create = false; ThreadSP thread_sp( |