[lxc-devel] [lxc/lxc] 4d8bdf: start: handle setting pdeath signal in new pidns

Serge Hallyn noreply at github.com
Fri Oct 4 14:33:25 UTC 2019


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 4d8bdfa0304fcf5a0355aa5ee4381c5c21a1bab1
      https://github.com/lxc/lxc/commit/4d8bdfa0304fcf5a0355aa5ee4381c5c21a1bab1
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2019-10-04 (Fri, 04 Oct 2019)

  Changed paths:
    M src/lxc/start.c
    M src/lxc/start.h
    M src/lxc/utils.c
    M src/lxc/utils.h

  Log Message:
  -----------
  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 at thejh.net>
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 345a21ca9ec1b736208611f4bec7e24097ce279b
      https://github.com/lxc/lxc/commit/345a21ca9ec1b736208611f4bec7e24097ce279b
  Author: Serge Hallyn <serge at hallyn.com>
  Date:   2019-10-04 (Fri, 04 Oct 2019)

  Changed paths:
    M src/lxc/start.c
    M src/lxc/start.h
    M src/lxc/utils.c
    M src/lxc/utils.h

  Log Message:
  -----------
  Merge pull request #2933 from brauner/2019-04-13/pdeath_signal_fixes

start: handle setting pdeath signal in new pidns


Compare: https://github.com/lxc/lxc/compare/1d24b87a1a12...345a21ca9ec1


More information about the lxc-devel mailing list