coreutils/build-aux
Tobias Stoeckmann 2f69dba5df 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
2017-02-09 22:15:43 -08:00
..
ChangeLog-2007 maint: update all copyright year number ranges 2017-01-01 22:38:02 +00:00
gen-lists-of-programs.sh timeout: fix race possibly terminating wrong process 2017-02-09 22:15:43 -08:00
gen-single-binary.sh maint: avoid file-scope names of the form _[a-z]* 2014-09-08 20:48:44 -07:00
git-log-fix doc: only distribute 5 years of ChangeLogs 2017-02-08 14:39:48 -08:00