Commit 82d89dce by Daniel Lezcano

more robustness against SIGCHLD

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: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 15cd25fd
......@@ -225,6 +225,7 @@ static int sigchld_handler(int fd, void *data,
{
struct signalfd_siginfo siginfo;
int ret;
pid_t *pid = data;
ret = read(fd, &siginfo, sizeof(siginfo));
if (ret < 0) {
......@@ -243,6 +244,14 @@ static int sigchld_handler(int fd, void *data,
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment