summaryrefslogtreecommitdiff
path: root/tests/cp/file-perm-race.sh
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2017-02-05 13:23:22 +0100
committerPádraig Brady <P@draigBrady.com>2017-02-09 22:15:43 -0800
commit2f69dba5df8caaf9eda658c1808b1379e9949f22 (patch)
tree06b6591378063be7c68882eb1cac0698eb25b20b /tests/cp/file-perm-race.sh
parent99deaff7e804298cecc326142bbe7263e2576224 (diff)
downloadcoreutils-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 'tests/cp/file-perm-race.sh')
0 files changed, 0 insertions, 0 deletions