diff options
author | Tobias Stoeckmann <tobias@stoeckmann.org> | 2017-02-05 13:23:22 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2017-02-09 22:15:43 -0800 |
commit | 2f69dba5df8caaf9eda658c1808b1379e9949f22 (patch) | |
tree | 06b6591378063be7c68882eb1cac0698eb25b20b /NEWS | |
parent | 99deaff7e804298cecc326142bbe7263e2576224 (diff) | |
download | coreutils-2f69dba5df8caaf9eda658c1808b1379e9949f22.tar.xz |
timeout: fix race possibly terminating wrong process
The race is unlikely, as timeout(1) needs to receive a signal
in the few operations between waitpid() returning and exit().
Also the system needs to have reallocated the just released pid
in this time window.
Previously we never disabled the signal handler that sent
the termination signal to the "child" pid. However once waitpid()
has reaped the child, the system is free to allocate that pid,
so we must ensure we don't process any further signals.
* build-aux/gen-lists-of-programs.sh: Build timeout(1) optionally...
* configure.ac: ...predicated on sigsuspend() being available.
* src/timeout.c (block_cleanup): A new function to ensure the
cleanup() handler is disabled after waitpid has returned.
(main): Use sigsuspend() to wait with cleanup() enabled but
disabled once it returns, and thus disabled for the waitpid() call.
(monitored_pid): Change to the more accurate pid_t.
* NEWS: Mention the fix.
Fixes http://bugs.gnu.org/25624
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -16,6 +16,12 @@ GNU coreutils NEWS -*- outline -*- which could be triggered especially when tail was suspended and resumed. [bug introduced with inotify support added in coreutils-7.5] + timeout no longer has a race that may terminate the wrong process. + The race is unlikely, as timeout(1) needs to receive a signal right + after the command being monitored finishes. Also the system needs + to have reallocated that command's pid in that short time window. + [bug introduced when timeout was added in coreutils-7.0] + wc --bytes --files0-from now correctly reports byte counts. Previously it may have returned values that were too large, depending on the size of the first file processed. |