[PATCH] Cygwin: sigtimedwait: Fix segfault when timeout is used
Takashi Yano
takashi.yano@nifty.ne.jp
Tue Nov 19 08:39:58 GMT 2024
On Mon, 18 Nov 2024 16:34:55 +0100
Corinna Vinschen wrote:
> Hi Takashi,
>
> thanks for looking into this problem.
>
> On Nov 18 00:48, Takashi Yano wrote:
> > @@ -640,6 +641,16 @@ sigwait_common (const sigset_t *set, siginfo_t *info, PLARGE_INTEGER waittime)
> > }
> > break;
> > case WAIT_TIMEOUT:
> > + _my_tls.lock ();
> > + if (_my_tls.sigwait_mask == 0)
> > + {
> > + /* sigpacket::process() already started. */
> > + waittime = cw_infinite;
>
> cw_infinite? Shouldn't this situation lead to cygwait returning
> immediately with WAIT_SIGNALLED? The theory would explain to me
> that the timeout doesn't matter in this case, but given that the
> actual, configured timeout already occured, wouldn't it be
> safer to set timeout to 0? Just in case?
The signal will arrive very soon definitely, so I think cw_infinite
can be used, I think. However, handling it as if WAIT_SIGNALED is
returned sounds more reasonable, so I'll submit v2 patch.
Could you please have a look?
--
Takashi Yano <takashi.yano@nifty.ne.jp>
More information about the Cygwin-patches
mailing list