diff options
author | jeffreytan81 <jeffreytan@meta.com> | 2024-03-06 10:50:32 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-06 10:50:32 -0800 |
commit | 8bdddcf0bb5a40e6ce6cbf7fc6b7ce576e2b032d (patch) | |
tree | 99a7095eb3d11047bfa161d275191f211251505b /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h | |
parent | 954f891af20d193f6a5f41d7ede6a9313a49cfc3 (diff) | |
download | llvm-8bdddcf0bb5a40e6ce6cbf7fc6b7ce576e2b032d.zip llvm-8bdddcf0bb5a40e6ce6cbf7fc6b7ce576e2b032d.tar.gz llvm-8bdddcf0bb5a40e6ce6cbf7fc6b7ce576e2b032d.tar.bz2 |
Fix lldb crash while handling concurrent vfork() (#81564)
We got user reporting lldb crash while the debuggee is calling vfork()
concurrently from multiple threads.
The crash happens because the current implementation can only handle
single vfork, vforkdone protocol transaction.
This diff fixes the crash by lldb-server storing forked debuggee's <pid,
tid> pair in jstopinfo which will be decoded by lldb client to create
StopInfoVFork for follow parent/child policy. Each StopInfoVFork will
later have a corresponding vforkdone packet. So the patch also changes
the `m_vfork_in_progress` to be reference counting based.
Two new test cases are added which crash/assert without the changes in
this patch.
---------
Co-authored-by: jeffreytan81 <jeffreytan@fb.com>
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h index c1ea1cc..610a1ee 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -301,7 +301,8 @@ protected: using FlashRange = FlashRangeVector::Entry; FlashRangeVector m_erased_flash_ranges; - bool m_vfork_in_progress; + // Number of vfork() operations being handled. + uint32_t m_vfork_in_progress_count; // Accessors bool IsRunning(lldb::StateType state) { |