]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/start.c
start: fix cgroup namespace preservation
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 12 Dec 2017 23:22:47 +0000 (00:22 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 12 Dec 2017 23:28:30 +0000 (00:28 +0100)
commit5af9369bf39931908f87fd6ad1a55e15041fe5c6
treecd81eccfec2fedbfd8ffe8a9d14d070e88c0159e
parentf449521ce675ba1b5c9a8a8ffc559016844dcec6
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@ubuntu.com>
src/lxc/criu.c
src/lxc/start.c
src/lxc/start.h
src/tests/shortlived.c