[Lldb-commits] [lldb] Fix lldb crash while handling concurrent vfork() (PR #81564)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 23 09:57:28 PST 2024


================
@@ -5670,8 +5673,9 @@ void ProcessGDBRemote::DidVFork(lldb::pid_t child_pid, lldb::tid_t child_tid) {
 }
 
 void ProcessGDBRemote::DidVForkDone() {
-  assert(m_vfork_in_progress);
-  m_vfork_in_progress = false;
+  assert(m_vfork_in_progress_count > 0);
+  if (m_vfork_in_progress_count > 0)
+    --m_vfork_in_progress_count;
----------------
clayborg wrote:

We decrement `m_vfork_in_progress_count` in two places, here and in `ProcessGDBRemote::DidExec()`. Before this wouldn't affect anything because it was a boolean, but  I fear we will decrement this twice now. We probably need to add an `exec()` into our test case for this to ensure this assertion doesn't fire as I believe the assertion inside of `ProcessGDBRemote::DidExec()` will assert and crash.

https://github.com/llvm/llvm-project/pull/81564


More information about the lldb-commits mailing list