Re: [PATCH v5] Cygwin: pty: Fix race issue between starting and exiting non-cygwin apps
Takashi Yano <[email protected]> Wed, 24 Jun 2026 07:50:22 +0900
| Newsgroups | gmane.os.cygwin.patches |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 23 Jun 2026 23:24:23 +0900 Takashi Yano wrote: > On Tue, 23 Jun 2026 21:29:25 +0900 > Takashi Yano wrote: > > > I am a little concerned if the replacement WFSO is equivalent to the > > > looping WFSO being replaced. I.e., it terminates for the same > > > condition(s) with the pty being in correct state. I can't point to > > > something specific though. Can you reassure me? Or is this just > > > re-establishing code to the way it was before? > > > > The code before the patch intended to leave wait-loop when pcon_start > > mode is set even though the pipe_sw_mutex was not acquired. With this > > patch, to_be_read_from_nat_pipe() is not called from master::write() > > anymore, so the busy-loop is not necessary due to changes below. > > > > @@ -2496,7 +2519,7 @@ fhandler_pty_master::write (const void *ptr, size_t len) > > @@ -2580,20 +2603,6 @@ fhandler_pty_master::write (const void *ptr, size_t len) > > Ah, I forgot to mention. > > to_be_read_from_nat_pipe() is called in master::write() below, however, > it is called only when pseudo console is not activated. In this case, > the slave is never in setup_pseudoconsole(). So to_be_read_from_nat_pipe() > can acquire pipe_sw_mutex after a short while. No! I was wrong. If master::write() is called when setup_pseudoconsole() is called but the pcon_activated is not set yet, to_be_read_from_nat_pipe() will be called while the slave holds pipe_sw_mutex. I'll revert this change, and submit v7 patch. -- Takashi Yano <[email protected]>