newlib-cygwin/winsup/cygwin/local_includes
Takashi Yano 3b4f6217c3 Cygwin: pty: Fix thread safety of readahead buffer handling in pty master.
Previously, though readahead buffer handling in pty master was not
fully thread-safe, accept_input() was called from peek_pipe() thread
in select.cc. This caused the problem reported in:
https://cygwin.com/pipermail/cygwin/2023-July/253984.html

The mechanism of the problem is:
1) accept_input() which is called from peek_pipe() thread calls
   eat_readahead(-1) before reading readahead buffer. This allows
   writing to the readahead buffer from another (main) thread.
2) The main thread calls fhandler_pty_master::write() just after
   eat_readahead(-1) was called and before reading the readahead
   buffer by accept_input() called from peek_pipe() thread. This
   overwrites the readahead buffer.
3) The read result from readahead buffer which was overwritten is
   sent to the slave.

This patch makes readahead buffer handling fully thread-safe using
input_mutex to resolve this issue.

Fixes: 7b03b0d8ce ("select.cc (peek_pipe): Call flush_to_slave whenever we're checking for a pty master.")
Reported-by: Thomas Wolff <towo@towo.net>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-04 17:49:29 +09:00
..
machine Cygwin: add local machine/asm.h header 2022-12-20 10:13:59 +01:00
child_info.h
clock.h
collate.h Cygwin: glob: implement collating symbol support 2023-02-20 22:50:17 +01:00
cpuid.h
create_posix_thread.h Cygwin: rename CygwinCreateThread to create_posix_thread 2022-08-10 18:06:28 +02:00
cygerrno.h
cygheap.h Allow deriving the current user's home directory via the HOME variable 2023-03-28 12:18:14 +02:00
cygheap_malloc.h
cygmalloc.h Cygwin: fork: fix a potential hang in fork 2022-08-29 12:25:24 +02:00
cygserver.h
cygserver_ipc.h
cygserver_msg.h
cygserver_pwdgrp.h
cygserver_sem.h
cygserver_setpwd.h
cygserver_shm.h
cygthread.h
cygtls.h Cygwin: cygtls: drop useless alignment directives 2022-09-05 19:52:28 +02:00
cygwait.h
cygwin-cxx.h
cygwin_version.h
cygxdr.h
debug.h Cygwin: push missing change to debug.h 2022-08-22 14:53:30 +02:00
devices.h
dll_init.h
dtable.h
environ.h
errmap.h
exception.h
fhandler.h Cygwin: pty: Fix thread safety of readahead buffer handling in pty master. 2023-08-04 17:49:29 +09:00
fhandler_virtual.h
gcc_seh.h
gmon.h
heap.h
lc_collelem.h Cygwin: nlsfuncs.cc: introduce collating elements and helper functions 2023-02-20 22:38:52 +01:00
lc_def_codesets.h Cygwin: locale: fix devanagari modifier 2023-02-26 17:17:33 +01:00
lc_era.h
lc_msg.h
ldap.h
loadavg.h
math.h
memory_layout.h Cygwin: fix two comments in heap.cc and memory_layout.h 2023-01-18 20:13:38 +01:00
miscfuncs.h Cygwin: miscfuncs.h: fix comment 2022-08-19 15:51:49 +02:00
mmap_alloc.h Cygwin: add memory_layout.h 2022-10-28 16:26:53 +02:00
mmap_helper.h
mount.h
mqueue_types.h
mtinfo.h
nfs.h
ntdll.h Cygwin: Fix compiling with w32api-headers v11.0.0 2023-05-01 11:40:52 +01:00
path.h
pathfinder.h
perprocess.h
pinfo.h
posix_timer.h
profil.h
pwdgrp.h
registry.h
sec_posixacl.h
security.h Cygwin: get_posix_access: Make mode_t parameter mandatory 2023-02-09 21:58:44 +01:00
select.h
shared_info.h Cygwin: open_shared: don't reuse shared_locations parameter as output 2023-01-17 16:32:14 +01:00
sigproc.h
spinlock.h
string.h
sync.h
thread.h
timerfd.h
tls_pbuf.h
tty.h Cygwin: ctty: Replace ctty constant with more descriptive macros. 2023-03-07 10:51:29 +09:00
userinfo.h
vstrlist.h
wchar.h Cygwin: Add ISO C11 functions c16rtomb, c32rtomb, mbrtoc16, mbrtoc32. 2023-07-31 22:39:09 +02:00
wincap.h wincap.h: add wincap member has_user_shstk 2023-06-20 10:06:56 +02:00
winf.h
wininfo.h
winlean.h Cygwin: fs_info: update filesystem flags and check Windows 7 flags 2023-03-20 12:55:30 +01:00
winsup.h Cygwin: wincap.h: clarify NO_COPY_RO usage 2023-01-12 10:51:39 +01:00