4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-25 08:37:33 +08:00
Takashi Yano b160b690b6 Cygwin: console: Fix a race issue between close() and open().
The open() call for console sometimes fails if the console owner
process is closing the console by close() at the same time. This
is due to mismatch state of con.owner variable and attaching state
to the console. With this patch, checking con.owner and attaching
to con.owner sequence in open(), and resetting con.owner and freeing
console sequence in close() are guarded by output_mutex to avoid
such a race issue.
Addresses: https://cygwin.com/pipermail/cygwin/2024-March/255575.html

Fixes: 3721a756b0d8 ("Cygwin: console: Make the console accessible from other terminals.")
Reported-by: Kate Deplaix <kit-ty-kate@outlook.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2024-03-04 11:58:09 +09:00

12 lines
500 B
Groff

Fixes:
------
- Fix the problem that console setup accesses shared memory which
is already unmapped due to race condition. To avoid this issue,
shared console memory will be kept mapped if it belongs to CTTY.
Addresses: https://cygwin.com/pipermail/cygwin/2024-February/255561.html
- Fix a race issue between console open() and close() which is caused
by state mismatch between con.owner and console attaching state.
Addresses: https://cygwin.com/pipermail/cygwin/2024-March/255575.html