Signal delivered while blocked

Z. Majeed zmajeed@sbcglobal.net
Tue Dec 28 13:41:30 GMT 2021


The discussion continued in https://sourceware.org/legacy-ml/cygwin/2017-08/msg00180.html


On Monday, December 27, 2021, 06:15:05 PM EST, David McFarland <corngood@gmail.com> wrote: 

> Hi Guys,
> 
> Some time ago (2017) a Postgres developer reported a signal issue
> not present in older version (2013)
> 
> https://sourceware.org/pipermail/cygwin/2017-August/234001.html
> 
> For what I can see the issue is still present.
> 
> 
> Ideas for debugging ?


I had a look at your program. What seems to be happening is that he
signal thread receives the signal, and uses find_tls to find a thread to
handle it. If this is after a call to sigpermit(), then the mask will
be zero and it will commit to sending the signal to the main thread of
the test program.

This is done without any lock, so the main thread can now handle an
existing signal, call sigforbid() then usleep().

At this point the signal thread can resume, queuing up the next signal,
and the main thread will pick it up when usleep calls
sig_dispatch_pending, even though the main thread signal mask now
disallows it.

The old thread ended with a discussion about whether this is even valid
se of sigprocmask(), which didn't seem to be resolved. Anyone have any
thoughts on that?



More information about the Cygwin-developers mailing list