coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fix race conditions in timeout(1)


From: Pádraig Brady
Subject: Re: Fix race conditions in timeout(1)
Date: Tue, 12 Mar 2024 13:42:09 +0000
User-agent: Mozilla Thunderbird

On 11/03/2024 16:22, Pádraig Brady wrote:
On 11/03/2024 15:17, Pádraig Brady wrote:
There was a narrow race condition reported at:
https://github.com/coreutils/coreutils/issues/82

Then I noticed another related race condition
in the case of failing fork().

Both should be addressed by the attached.

Actually the second one to ensure processes are killed
is only moving the race around, since the child may
receive the signal in the same narrow window before assigning
monitored_pid, and ignore it.

The attached avoids the issue by blocking signal handling
until monitored_pid is in a deterministic state wrt fork().

I'll think a bit more about this before applying.

The previous patch flip flops the signal mask a couple of times.
We can simplify by expanding the critical section a little
and thus only blocking the cleanup signals once,
and continue to use sigsuspend() to reenable signals in the parent.
I'll push the attached later.

cheers,
Pádraig

Attachment: 0002-timeout-fix-narrow-race-in-failing-to-kill-processes.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]