- Closing attach_mutex and recreating it causes the race issue
between pty and console codes. With this patch, attach_mutex
is created only once in a process which opens pty, and never
closed in order to avoid this issue.
Addresses:
https://cygwin.com/pipermail/cygwin-developers/2021-Decem
- Acquiring input_mutex and attach_mutex in console code has potential
risk of deadlock. This patch fixes the issue.
---
winsup/cygwin/fhandler.h | 2 ++
winsup/cygwin/select.cc | 7 ---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/
- GDB inferior may be suspended while the inferior grabs mutex.
This causes deadlock in terminal I/O. With this patch, timeout
for waiting mutex is set to 0 for the debugger process when the
process calls CreateProcess() with DEBUG_PROCESS flag to avoid
deadlock. This may cause the race iss
Takashi Yano (4):
Cygwin: pty, console: Fix deadlock in GDB regarding mutex.
Cygwin: pty: Fix memory leak in master_fwd_thread.
Cygwin: pty: Stop closing and recreating attach_mutex.
Cygwin: console: Fix potential deadlock regarding acuqiring mutex.
winsup/cygwin/fhandler.h | 5
- If master_fwd_thread is terminated by cygthread::terminate_thread(),
the opportunity to release tmp_pathbuf is missed, resulting in a
memory leak. This patch fixes the issue.
---
winsup/cygwin/fhandler_tty.cc | 6 +-
winsup/cygwin/tty.cc | 1 +
winsup/cygwin/tty.h | 1