<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/101475>101475</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[lldb] lldb-server may crash in the child process monitor thread
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lldb
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
slydiman
</td>
</tr>
</table>
<pre>
Host::LaunchProcess() requires to SetMonitorProcessCallback. This callback is called from the child process monitor thread. We cannot control this thread anyway. GDBRemoteCommunicationServerPlatform::DebugserverProcessReaped() may cause a crash if this callback will be called from the child monitor thread after destroing the instance of GDBRemoteCommunicationServerPlatform.
https://github.com/llvm/llvm-project/blob/2d3655037ccfa276cb0949c2ce0cff56985f6637/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp#L521-L526
And m_port_map requires an own mutex guard here.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUk01vnDAQhn-NuYwWwfC1HDhssqI9pFKUVOoxMvYAbo1NbZN0_30FbJr2UDW9YCN7Pp7x-3Lv1WCIGlbcsOIc8SWM1jVeX6SauIk6Ky_NR-sDy04sO93xxYjx3llB3jM8MqzB0fdFOfIQLDxS-GSNCtZd79xyrTsuvsXweVQexPUXrnuS0Ds7QRgJxKi0hHmPg2lPA2F0xGUMXwgEN8YGENYEZzWENeF-DNxcXvglhg_nmweabKBbO02LUYIHZc0juWdy95qH3rppJzlTtwx-P9hLPhCfSV6hJn4BwRdPwEE47kdQ_V7xF8KL0ho6-gvHn_0D7wM5kOSDs8oM20VlfOBGENj-XY3HwJIzS077dwxh9isLtgzbQYVx6WJhJ4at1s-vy2F29iuJwLDttO0YtiizsiiSrBKi51iVokvqvBYoKBF9X5T1sejLMqu2BHKN8HZxghi293oZlPHr7lUB7SC7g9s6Z9i-i0LMM8PsrsD0cFdg-TvTyUiYnmbrwtPE5zdlcQP2xcC0BPoBw8KdhJEcxXtUJJtM1lnNI2rSCrFIsciraGyqJO3KY1eKFHOeleVRkkCSdccxSUtMI9VggnlyTNI0zRGrWNQVr2rZp6mo6UgFyxOauNLxOsvYuiFS3i_UpEmaV0WkeUfab95B3KeFq4tcs81-VRjLE6188G8Zggp689sWUJxhXQ-7FHfd7Xoz_3RFtDjd_LcONoL16a4Qzw3-DAAA__9SyVuX">