summaryrefslogtreecommitdiff
path: root/support/timespec.h
diff options
context:
space:
mode:
authorAdam Yi <ayi@janestreet.com>2023-03-07 07:30:02 -0500
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-03-07 09:54:50 -0300
commit436a604b7dc741fc76b5a6704c6cd8bb178518e7 (patch)
tree75d6a1a75d91885f4005bf6a17b947b785917e1a /support/timespec.h
parent969e9733c7d17edf1e239a73fa172f357561f440 (diff)
downloadglibc-436a604b7dc741fc76b5a6704c6cd8bb178518e7.tar.gz
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>
Diffstat (limited to 'support/timespec.h')
-rw-r--r--support/timespec.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/support/timespec.h b/support/timespec.h
index 77b1e4e8d6..9559836d4c 100644
--- a/support/timespec.h
+++ b/support/timespec.h
@@ -57,6 +57,8 @@ int support_timespec_check_in_range (struct timespec expected,
struct timespec observed,
double lower_bound, double upper_bound);
+struct timespec dtotimespec (double sec) __attribute__((const));
+
#else
struct timespec __REDIRECT (timespec_add, (struct timespec, struct timespec),
timespec_add_time64);
@@ -82,6 +84,8 @@ int __REDIRECT (support_timespec_check_in_range, (struct timespec expected,
double lower_bound,
double upper_bound),
support_timespec_check_in_range_time64);
+
+struct timespec __REDIRECT (dtotimespec, (double sec), dtotimespec_time64);
#endif
/* Check that the timespec on the left represents a time before the