1. 19 Jan, 2018 9 commits
  2. 02 Jan, 2018 11 commits
  3. 01 Jan, 2018 11 commits
  4. 18 Dec, 2017 1 commit
  5. 17 Dec, 2017 8 commits
    • tests: s/lxc.init.cmd/lxc.init_cmd/g · 36cffe6e
      Christian Brauner authored
      lxc.init.cmd is the new key that stable-2.0 doesn't know about.
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
    • lxc_init: fix cgroup parsing · 3fe57496
      Christian Brauner authored
      coverity: #1426132
      coverity: #1426133
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
    • namespace: add lxc_raw_clone() · a7ef3151
      Christian Brauner authored
      This is based on raw_clone in systemd but adapted to our needs. The main reason
      is that we need an implementation of fork()/clone() that does guarantee us that
      no pthread_atfork() handlers are run. While clone() in glibc currently doesn't
      run pthread_atfork() handlers we should be fine but there's no guarantee that
      this won't be the case in the future. So let's do the syscall directly - or as
      direct as we can. An additional nice feature is that we get fork() behavior,
      i.e. lxc_raw_clone() returns 0 in the child and the child pid in the parent.
      
      Our implementation tries to make sure that we cover all cases according to
      kernel sources. Note that we are not interested in any arguments that could be
      passed after the stack.
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
    • commands: fix race when open()/close() cmd socket · 59beaa6f
      Christian Brauner authored
      When we report STOPPED to a caller and then close the command socket it is
      technically possible - and I've seen this happen on the test builders - that a
      container start() right after a wait() will receive ECONNREFUSED because it
      called open() before we close(). So for all new state clients simply close the
      command socket. This will inform all state clients that the container is
      STOPPED and also prevents a race between a open()/close() on the command socket
      causing a new process to get ECONNREFUSED because we haven't yet closed the
      command socket.
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
    • SHARE_NS options should be before OPT_USAGE · 76365631
      Tycho Andersen authored
      Signed-off-by: 's avatarTycho Andersen <tycho@tycho.ws>
    • init: don't kill(-1) if we aren't in a pid ns · 76c31763
      Tycho Andersen authored
      ...otherwise we'll kill everyone on the machine. Instead, let's explicitly
      try to kill our children. Let's do a best effort against fork bombs by
      disabling forking via the pids cgroup if it exists. This is best effort for
      a number of reasons:
      
      * the pids cgroup may not be available
      * the container may have bind mounted /dev/null over pids.max, so the write
        doesn't do anything
      Signed-off-by: 's avatarTycho Andersen <tycho@tycho.ws>
    • start: fix cgroup namespace preservation · 662a9832
      Christian Brauner authored
      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: 's avatarChristian Brauner <christian.brauner@ubuntu.com>