diff options
author | Adam Yi <ayi@janestreet.com> | 2023-03-07 07:30:02 -0500 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-03-07 09:54:50 -0300 |
commit | 436a604b7dc741fc76b5a6704c6cd8bb178518e7 (patch) | |
tree | 75d6a1a75d91885f4005bf6a17b947b785917e1a /support/dtotimespec-time64.c | |
parent | 969e9733c7d17edf1e239a73fa172f357561f440 (diff) | |
download | glibc-436a604b7dc741fc76b5a6704c6cd8bb178518e7.tar.gz glibc-436a604b7dc741fc76b5a6704c6cd8bb178518e7.tar.xz glibc-436a604b7dc741fc76b5a6704c6cd8bb178518e7.zip |
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/dtotimespec-time64.c')
-rw-r--r-- | support/dtotimespec-time64.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/support/dtotimespec-time64.c b/support/dtotimespec-time64.c new file mode 100644 index 0000000000..b3d5e351e3 --- /dev/null +++ b/support/dtotimespec-time64.c @@ -0,0 +1,27 @@ +/* Convert double to timespec. 64-bit time support. + Copyright (C) 2011-2023 Free Software Foundation, Inc. + This file is part of the GNU C Library and is also part of gnulib. + Patches to this file should be submitted to both projects. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <time.h> + +#if __TIMESIZE != 64 +# define timespec __timespec64 +# define time_t __time64_t +# define dtotimespec dtotimespec_time64 +# include "dtotimespec.c" +#endif |