network scripts: don't block SIGCHLD before forking
commit885660bd48efbe3742892e06de7a8898703e0bdc
authorMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 8 Dec 2011 03:48:07 +0000 (7 21:48 -0600)
committerAnthony Liguori <aliguori@us.ibm.com>
Thu, 15 Dec 2011 16:22:40 +0000 (15 10:22 -0600)
tree53cc1f3b0d441246800120a4272f9b4482fa29ee
parentf603a687ff722e9df3e6e4730ca4e267aa2b124e
network scripts: don't block SIGCHLD before forking

This patch fixes a bug where child processes of launch_script() can
misbehave due to SIGCHLD being blocked. In the case of `sudo`, this
causes a permanent hang.

Previously a SIGCHLD handler was added to reap fork_exec()'d zombie
processes by calling waitpid(-1, ...). This required other
fork()/waitpid() callers to temporarilly block SIGCHILD to avoid
having the final wait status being intercepted by the SIGCHLD
handler:

7c3370d4fe3fa6cda8655f109e4659afc8ca4269

Since then, the qemu_add_child_watch() interface was added to allow
registration of such processes and reap only from that specific set
of PIDs:

4d54ec7898bd951007cb6122d5315584bd41d0c4

As a result, we can now avoid blocking SIGCHLD in launch_script(), so
drop that behavior.

Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net/tap.c