Skip to contentSkip to conversation

signal: Don't restart fork when signals come in.

PATCH Eric W. Biederman 1 participant 1 message Aug 10, 2018 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 37 lines · <[email protected]> writes:

[email protected] <[email protected]> writes

Quoted 30 lines

Subject: [PATCH v6 6/6] signal: Don't restart fork when signals come in.

Wen Yang <[email protected]> and majiang <[email protected]> report that a periodic signal received during fork can cause fork to continually restart preventing an application from making progress.

...

kernel/signal.c +0 -0
index 9f0eafb6d474..cfa9d10e731a 100644
@@ -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);

kernel/signal.c +15 -0
+
+ /* 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);
+ }
+ }
+
Quoted 3 lines

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:

Quoted 6 lines

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