From e1bd337865fca9f455225ba37b76595d37bad213 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Thu, 11 Jul 2024 14:04:19 +0200 Subject: [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. --- lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp') diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index 81ee7e328b6c..e026ffefd645 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 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( -- cgit v1.2.3