If the SIGCHLD is sent from a process different from the container's init
process we ignore it, otherwise we finish to wait it.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
{
struct signalfd_siginfo siginfo;
int ret;
+ pid_t *pid = data;
ret = read(fd, &siginfo, sizeof(siginfo));
if (ret < 0) {
return 0;
}
+ /* more robustness, protect ourself from a SIGCHLD sent
+ * by a process different from the container init
+ */
+ if (siginfo.ssi_pid != *pid) {
+ WARN("invalid pid for SIGCHLD");
+ return 0;
+ }
+
DEBUG("container init process exited");
return 1;
}