Unverified Commit 45265bfd by Christian Brauner Committed by GitHub

Merge pull request #2903 from flx42/fix-pid-namespace-pdeathsig-handling

Fix PID namespace pdeathsig handling
parents 2009688d b765aa88
...@@ -1112,7 +1112,7 @@ static int do_start(void *data) ...@@ -1112,7 +1112,7 @@ static int do_start(void *data)
* exit before we set the pdeath signal leading to a unsupervized * exit before we set the pdeath signal leading to a unsupervized
* container. * container.
*/ */
ret = lxc_set_death_signal(SIGKILL, 0); ret = lxc_set_death_signal(SIGKILL, handler->monitor_pid);
if (ret < 0) { if (ret < 0) {
SYSERROR("Failed to set PR_SET_PDEATHSIG to SIGKILL"); SYSERROR("Failed to set PR_SET_PDEATHSIG to SIGKILL");
goto out_warn_father; goto out_warn_father;
......
...@@ -1705,9 +1705,9 @@ int lxc_set_death_signal(int signal, pid_t parent) ...@@ -1705,9 +1705,9 @@ int lxc_set_death_signal(int signal, pid_t parent)
ret = prctl(PR_SET_PDEATHSIG, prctl_arg(signal), prctl_arg(0), ret = prctl(PR_SET_PDEATHSIG, prctl_arg(signal), prctl_arg(0),
prctl_arg(0), prctl_arg(0)); prctl_arg(0), prctl_arg(0));
/* Check whether we have been orphaned. */ /* If not in a PID namespace, check whether we have been orphaned. */
ppid = (pid_t)syscall(SYS_getppid); ppid = (pid_t)syscall(SYS_getppid);
if (ppid != parent) { if (ppid && ppid != parent) {
ret = raise(SIGKILL); ret = raise(SIGKILL);
if (ret < 0) if (ret < 0)
return -1; 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