llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Kazu Hirata (kazutakahirata) <details> <summary>Changes</summary> While SigchldHandler iterates over m_processes with llvm::any_of to find the process that owns a waitpid event, handling an event can destroy a NativeProcessLinux instance and erase it from m_processes. Continuing the iteration with invalidated iterators triggers assertion failures under epoch checks. Snapshotting m_processes into a vector with llvm::to_vector before the loop ensures that iterator traversal is safe from container mutations. This bug was discovered with tightened epoch checks in SmallPtrSetIterator. Assisted-by: Antigravity --- Full diff: https://github.com/llvm/llvm-project/pull/219752.diff 1 Files Affected: - (modified) lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp (+2-1) ``````````diff diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 6a73999fe0b74..52f4b50e96517 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -403,7 +403,8 @@ void NativeProcessLinux::Manager::SigchldHandler() { // vice-versa. This means that if the child event arrives first, it may not // be handled by any process (because it doesn't know the thread belongs to // it). - bool handled = llvm::any_of(m_processes, [&](NativeProcessLinux *process) { + auto processes = llvm::to_vector(m_processes); + bool handled = llvm::any_of(processes, [&](NativeProcessLinux *process) { return process->TryHandleWaitStatus(pid, status); }); if (!handled) { `````````` </details> https://github.com/llvm/llvm-project/pull/219752 _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
