]> git.ipfire.org Git - thirdparty/glibc.git/commit
posix: Fix system blocks SIGCHLD erroneously [BZ #30163]
authorAdam Yi <ayi@janestreet.com>
Tue, 7 Mar 2023 12:30:02 +0000 (07:30 -0500)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 28 Apr 2023 14:36:24 +0000 (16:36 +0200)
commit567f7413fb1179acd936766b542ea72f7ef60d8b
tree4ab2322e4a70250b3d0c27470b0e0fe6f3c53baa
parent71eb9cc1ffd79e96549dfb16f8e86aaf88a3bac8
posix: Fix system blocks SIGCHLD erroneously [BZ #30163]

Fix bug that SIGCHLD is erroneously blocked forever in the following
scenario:

1. Thread A calls system but hasn't returned yet
2. Thread B calls another system but returns

SIGCHLD would be blocked forever in thread B after its system() returns,
even after the system() in thread A returns.

Although POSIX does not require, glibc system implementation aims to be
thread and cancellation safe. This bug was introduced in
5fb7fc96350575c9adb1316833e48ca11553be49 when we moved reverting signal
mask to happen when the last concurrently running system returns,
despite that signal mask is per thread. This commit reverts this logic
and adds a test.

Signed-off-by: Adam Yi <ayi@janestreet.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 436a604b7dc741fc76b5a6704c6cd8bb178518e7)
NEWS
stdlib/tst-system.c
support/Makefile
support/dtotimespec-time64.c [new file with mode: 0644]
support/dtotimespec.c [new file with mode: 0644]
support/shell-container.c
support/timespec.h
sysdeps/posix/system.c