[ccache] ccache interrupt handling bug
lists at eitanadler.com
Wed Aug 19 04:33:44 UTC 2015
On 18 August 2015 at 21:17, Tom Lane <tgl at sss.pgh.pa.us> wrote:
> Joel Rosdahl <joel at rosdahl.net> writes:
>> Tom Lane <tgl at sss.pgh.pa.us> wrote:
>>> Actually, that's a bug not just a cosmetic problem, because it introduces
>>> a race condition.
>> Yes, sounds like a race condition that could happen.
>> I just pushed this change as a fix:
>> Opinions on it are welcome.
> Hm. In principle there are still race conditions here: consider what
> happens if the SIGINT is received between fork() and storing the PID
> into *pid, or after waitpid() and before clearing *pid.
FWIW the current signal handler is not fully safe. In particular, it
modifies variables which are not volatile sig_atomic_t (see section
126.96.36.199 of the C11 standard for more details). The call to unlink()
is safe per POSIX but is not safe according to strict C semantics (see
Similarly, _Exit is required by C, though _exit is safe per POSIX.
More information about the ccache