Source-Changes-D archive

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

Re: CVS commit: src/tests/lib/libc/sys



On 14.05.2020 23:02, Joerg Sonnenberger wrote:
> On Thu, May 14, 2020 at 07:21:35PM +0000, Kamil Rytarowski wrote:
>> Module Name:	src
>> Committed By:	kamil
>> Date:		Thu May 14 19:21:35 UTC 2020
>>
>> Modified Files:
>> 	src/tests/lib/libc/sys: t_ptrace_fork_wait.h
>>
>> Log Message:
>> Ignore interception of the SIGCHLD signals.
>>
>> SIGCHLD once blocked is discarded by the kernel as it has the
>> SA_IGNORE property. During the fork(2) operation all signals can be
>> shortly blocked and missed (unless there is a registered signal
>> handler in the traced child). This leads to a race in this test if
>> there would be an intention to catch SIGCHLD.
> 
> This doesn't sound right. sigprocmask and pthread_sigmask shouldn't
> affect whether the signal handler is called, only when. Temporarily
> masking a signal is different from setting it to SIG_IGN.
> 
> Joerg
> 

I was looking into it and as there is no signal handler for SIGCHLD, the
signal is discarded.

Another approach to fix the race would be to:

1. Add SIGCHLD signal handler in the traced child.
2. Explicitly masking SIGCHLD in the traced child.

If a signal would not reach the child process (as it is ignored or
masked+SA_IGNOREd) and it is not a crash signal, it is dropped. As I
checked, it's the design in UNIX to overlook SIGCHLD signals in UNIX.
Race free signals could be maybe possible, but with some design rethinking.

Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index