Re: [PATCH v6 6/6] signal: Don't restart fork when signals come in.
From: Eric W. Biederman
Date: Fri Aug 10 2018 - 08:15:51 EST
<wen.yang99@xxxxxxxxxx> writes:
> ebiederm@xxxxxxxxxxxx <ebiederm@xxxxxxxxxxxx> writes
>> Subject: [PATCH v6 6/6] signal: Don't restart fork when signals come in.
>>
>> Wen Yang <wen.yang99@xxxxxxxxxx> and majiang <ma.jiang@xxxxxxxxxx>
>> report that a periodic signal received during fork can cause fork to
>> continually restart preventing an application from making progress.
>>
>> ...
>> diff --git a/kernel/signal.c b/kernel/signal.c
>> index 9f0eafb6d474..cfa9d10e731a 100644
>> --- a/kernel/signal.c
>> +++ b/kernel/signal.c
>> @@ -1121,6 +1121,21 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
>> out_set:
>> signalfd_notify(t, sig);
>> sigaddset(&pending->signal, sig);
>> +
>> + /* Let multiprocess signals appear after on-going forks */
>> + if (type > PIDTYPE_TGID) {
>> + struct multiprocess_signals *delayed;
>> + hlist_for_each_entry(delayed, &t->signal->multiprocess, node) {
>> + sigset_t *signal = &delayed->signal;
>> + /* Can't queue both a stop and a continue signal */
>> + if (sig == SIGCONT)
>> + sigdelsetmask(signal, SIG_KERNEL_STOP_MASK);
>> + else if (sig_kernel_stop(sig))
>> + sigdelset(signal, SIGCONT);
>> + sigaddset(signal, sig);
>> + }
>> + }
>> +
>> complete_signal(sig, t, type);
>> ret:
>> trace_signal_generate(sig, info, t, type != PIDTYPE_PID, result);
>
> I've migrated this patch and try to test it, but I ran into a compile error:
>
> kernel/signal.c: In function '__send_signal':
> kernel/signal.c:1192:9: error: 'type' undeclared (first use in this function)
> if (type > PIDTYPE_TGID) {
> ^
> We may also need some patches, which pass pid type into
> __send_signal.
We most definitely need the the first 15 patches from my last series of
patches that push the pid type down.
I did not repeat them here because there is consensus that they
are fine working fine.
I have a branch with everything at:
https://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git siginfo-testing
Eric