Bug#414021: SIGSTOP then SIGCONT on a whole process incorrectly releases a thread from sigwait(3) for another signal
On Thu, Mar 08, 2007 at 05:18:28PM +0000, Tom Viza wrote:
> Package: linux-image-2.6-amd64
> Version: 2.6.18+6
>
> I've already tried to report this bug upstream at:
> http://sources.redhat.com/bugzilla/show_bug.cgi?id=4169
>
> but the maintainers of glibc say that this is a bug in the kernel and
> not in NPTL.
>
> So...
>
> If a whole process, which has a thread waiting with sigwait(3), is stopped with
> SIGSTOP, then when it is restarted with SIGCONT sigwait returns without writing
> to *sig (second argument). This appears to be in contradiction with
> POSIX-1003.1 2004.
>
> http://www.opengroup.org/onlinepubs/000095399/functions/sigwait.html
>
> Steps to reproduce:
>
> $ wget http://purposeful.co.uk/testcase.c
> $ gcc -o testcase -pthread -lpthread testcase.c
> $./testcase
>
> The test program prints 'a' from one thread and 'b' from another. After ten of
> each the 'b' thread calls sigwait, and you get just 'a's. When this happens,
> hit Ctrl+Z. Now restart the process (with fg). The 'b' thread resumes straight
> away.
With 2.6.30 this seems fixed (by running the test case, not code inspection).
Please reopen if you come to a different conclusion.
Cheers,
Moritz
Reply to: