]> git.ipfire.org Git - thirdparty/lxc.git/commit
start: handle setting pdeath signal in new pidns 2933/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 13 Apr 2019 14:41:30 +0000 (16:41 +0200)
committerSerge Hallyn <shallyn@cisco.com>
Fri, 4 Oct 2019 14:31:37 +0000 (07:31 -0700)
commit4d8bdfa0304fcf5a0355aa5ee4381c5c21a1bab1
treec9680d5c2f74d4440d99258aec5be4b127e9221a
parent1d24b87a1a12979a27cd0416211c229635ab1a5f
start: handle setting pdeath signal in new pidns

In the usual case the child runs in a separate pid namespace. So far we haven't
been able to reliably set the pdeath signal. When we set the pdeath signal we
need to verify that we haven't lost a race whereby we have been orphaned and
though we have set a pdeath signal it won't help us since, well, the parent is
dead.
We were able to correctly handle this case when we were in the same pidns since
getppid() will return a valid pid. When we are in a separate pidns 0 will be
returned since the parent doesn't exist in our pidns.
A while back, while Jann and I were discussing other things he came up with a
nifty idea: simply pass an fd for the parent's status file and check the
"State:" field. This is the implementation of that idea.

Suggested-by: Jann Horn <jann@thejh.net>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/start.c
src/lxc/start.h
src/lxc/utils.c
src/lxc/utils.h