]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/start.c
start.c: handle potential signal flood
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Thu, 29 Aug 2013 15:41:19 +0000 (10:41 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Thu, 29 Aug 2013 19:53:18 +0000 (14:53 -0500)
commit80507ee8eb66f4f23494caae26f6d2f0b50480b6
treead60f53e42fd9cb374ab710a7990baf4517ee79c
parent48c63f8d035045af1103b677b5ec577aec59a5b5
start.c: handle potential signal flood

Signalfd does not guarantee that we'll get an event for every signal.
So if 3 tasks exit at the same time, we may get only one sigchld
event.  Therefore, in signal_handler(), always check whether init has
exited.  Do with with WNOWAIT so that we can still wait4 to cleanup
the init after lxc_poll() exists (rather than complicating the code).

Note - there is still a race in the kernel which can cause the
container init to become a defunct child of the host init (!).  This
doesn't solve that, but is a potential (if very unlikely) race which
apw pointed out while we were trying to create a reproducer for the
kernel bug.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/start.c