[PATCH 11/15] Hurd signals: fix sigwait() for global signals

Jeremie Koenig jk@jk.fr.eu.org
Wed Jul 20 04:47:00 GMT 2011


On Sun, Jul 03, 2011 at 02:32:00AM +0200, Samuel Thibault wrote:
> Jeremie Koenig, le Wed 29 Jun 2011 18:30:23 +0200, a écrit :
> > * sysdeps/mach/hurd/sigwait.c (__sigwait): Change the blocking mask
> > temporarily so that we catch global as well as thread-specific signals.
> 
> Mmm, this is unsafe: if yet another signal arrives between the
> setjmp return and locking ss, it will be processed instead of being
> blocked.

The attached patch fixes this: the blocking mask is restored by the
preemptor rather than by sigwait() itself.

While testing it I stumbled upon another (long-standing) bug whereby
sigwait does not clear a signal which was pending prior to calling it.
The other attached patch fixes that.

-- 
Jeremie Koenig <jk@jk.fr.eu.org>
http://jk.fr.eu.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sigwait-race.diff
Type: text/x-diff
Size: 6285 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20110720/e2990814/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sigwait-pending.diff
Type: text/x-diff
Size: 3800 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20110720/e2990814/attachment-0001.bin>


More information about the Libc-alpha mailing list