[lxc-devel] [lxc/lxc] 5af936: start: fix cgroup namespace preservation

GitHub noreply at github.com
Thu Dec 14 06:45:54 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 5af9369bf39931908f87fd6ad1a55e15041fe5c6
      https://github.com/lxc/lxc/commit/5af9369bf39931908f87fd6ad1a55e15041fe5c6
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-12-13 (Wed, 13 Dec 2017)

  Changed paths:
    M src/lxc/criu.c
    M src/lxc/start.c
    M src/lxc/start.h
    M src/tests/shortlived.c

  Log Message:
  -----------
  start: fix cgroup namespace preservation

Prior to this patch we raced with a very short-lived init process. Essentially,
the init process could exit before we had time to record the cgroup namespace
causing the container to abort and report ABORTING to the caller when it
actually started just fine. Let's not do this.

(This uses syscall(SYS_getpid) in the the child to retrieve the pid just in case
we're on an older glibc version and we end up in the namespace sharing branch
of the actual lxc_clone() call.)

Additionally this fixes the shortlived tests. They were faulty so far and
should have actually failed because of the cgroup namespace recording race but
the ret variable used to return from the function was not correctly
initialized. This fixes it.
Furthermore, the shortlived tests used the c->error_num variable to determine
success or failure but this is actually not correct when the container is
started daemonized.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 45acc1bd8c890da50cccbd18140a1b56354496be
      https://github.com/lxc/lxc/commit/45acc1bd8c890da50cccbd18140a1b56354496be
  Author: Serge Hallyn <serge at hallyn.com>
  Date:   2017-12-14 (Thu, 14 Dec 2017)

  Changed paths:
    M src/lxc/criu.c
    M src/lxc/start.c
    M src/lxc/start.h
    M src/tests/shortlived.c

  Log Message:
  -----------
  Merge pull request #2030 from brauner/2017-12-13/fix_cgroup_namsepace_recording

start: fix cgroup namespace preservation


Compare: https://github.com/lxc/lxc/compare/941ee1fe2a22...45acc1bd8c89


More information about the lxc-devel mailing list