[Lldb-commits] [lldb] [lldb] Improved lldb-server stability for remote launching (PR #100659)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Mon Jul 29 01:17:21 PDT 2024
labath wrote:
> * thread 1 opens a file for writing (file descriptor A) and starts writing it
>
> * thread 2 starts launching a gdb server. It calls fork(), which creates another process with a copy of fd A (the fd has the CLOEXEC flag set, but not CLOFORK (the flag doesn't exist))
>
> * thread 1 finishes writing, closes fd A (in its/parent process)
>
> * thread 1launches gdb-server, gdb-server tries to launch the file it has just written, gets ETXTBSY because the fd is still open in the child process
In this scenario, waiting does make the exec succeed, because the FD in the forked process will not stay open very long. It will get closed as soon as the process runs `execve` (due to CLOEXEC).
https://github.com/llvm/llvm-project/pull/100659
More information about the lldb-commits
mailing list