[PATCH 3/4] Cygwin: pty: Stop closing and recreating attach_mutex.

2022-01-13 Thread Takashi Yano
- 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

[PATCH 4/4] Cygwin: console: Fix potential deadlock regarding acuqiring mutex.

2022-01-13 Thread Takashi Yano
- 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/

[PATCH 1/4] Cygwin: pty, console: Fix deadlock in GDB regarding mutex.

2022-01-13 Thread Takashi Yano
- 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

[PATCH 0/4] Some fixes for console and pty.

2022-01-13 Thread Takashi Yano
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

[PATCH 2/4] Cygwin: pty: Fix memory leak in master_fwd_thread.

2022-01-13 Thread Takashi Yano
- 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