1. 31 Jan, 2016 5 commits
  2. 30 Jan, 2016 2 commits
  3. 29 Jan, 2016 13 commits
  4. 28 Jan, 2016 20 commits
    • Fix echo statement inside fedora template · 95658200
      Nehal J Wani authored
      We no longer use mirrors.kernel.org.
      Commit f71e8f41 switched it to archives.fedoraproject.org
      Signed-off-by: 's avatarNehal J Wani <nehaljw.kkd1@gmail.com>
    • Fix message after {fedora|centos}container creation · d510d522
      Nehal J Wani authored
      If the backingstore is not 'dir', then lxc shouldn't ask the user
      to change the password by performing a 'chroot'. Rather, the user
      should start, attach, use the passwd command, and then stop the
      container.
      
      Fixes #731
      Signed-off-by: 's avatarNehal J Wani <nehaljw.kkd1@gmail.com>
    • lxc-test-usernic: update to reflect new lxc-test-usernic arguments · 615af4ac
      Serge Hallyn authored
      the new lxcpath and lxcname are not optional
      Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
    • allow cgroupfs mounts under /sys/fs/cgroup · 833bf9c2
      Serge Hallyn authored
      Systemd needs to be able to do these, and it does not bypass
      any of our apparmor rules.
      Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
    • cgroup ns: move the check for whether cgns is supported · fe3c80af
      Serge Hallyn authored
      We have to do it before we join the container's mntns so we have
      the host's procdir.
      Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
    • Fix Android build of lxc-ls · 6361a0f2
      Stéphane Graber authored
      Signed-off-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
    • fork off a task to delete ovs ports when done · c43cbc04
      Serge Hallyn authored
      The new task waits until the container is STOPPED, then asks
      openvswitch to delete the port.
      
      This requires two new arguements to be sent to lxc-user-nic.
      Since lxc-user-nic ships with lxc, this shouldn't be a problem.
      
      Finally when calling lxc-user-nic, use execlp insteac of execvp
      to preserve lxcpath's const-ness.  Technically we are
      guaranteed that execvp won't change the args, but it's worth
      it to silence the warnings (and not hide real errors).
      
      With this patch, container nics are cleaned up from openvswitch
      bridges on shutdown.
      Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
      Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
    • Fix Android build failure · 23c9c64d
      Stéphane Graber authored
      Signed-off-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
    • lxc-ls: tweak algorithm for ls_has_all_grps() · fa659172
      Christian Brauner authored
      - With the -g/--groups argument the user can give a comma-separated list of
        groups MUST a container must have in order to be displayed. We receive
        this list as a single string. ls_has_all_grps() is called to check if a
        container has all the groups of MUST in its current list of groups HAS. I.e.
        we determine whether MUST ⊆ HAS and only then do we record the container.
        The original implementation was dumb in that it split the string MUST
        everytime it needed to check whether MUST ⊆ HAS for a given container. That's
        pointless work. Instead we split the string MUST only once in main() and pass
        it to ls_get() which passes it along to ls_has_all_grps().
      - Before doing any costly checking make sure that #MUST <= #HAS. If not bail
        immediately.
      - The linear search algorithm ls_has_all_grps() currently uses stays for now.
        Binary search et al. do not seem to make sense since sorting the array HAS
        for each container is probably too costly. Especially, since it seems
        unlikely that a users specifies 50+ or so groups on the command line a
        container must have to be displayed. If however there are a lot of use-cases
        where users have a lot of containers each with 50-100 groups and regularly use
        lxc-ls with -g/--groups to only show containers that have 50 specified groups
        among their 50-100 groups we can revisit this issue and implement e.g. binary
        search or a ternary search tree.
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@mailbox.org>
      Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
    • Restore old behaviour [filter] behaviour · 4763f6ca
      Christian Brauner authored
      In the Python implementation users could pass a regex without a parameter flag
      as additional argument on the command line. The C implementation gained the
      flag -r/--regex for this. To not irritate users we restore the old behaviour
      and additionally rename -r/--regex to --filter to allow eplicitly passing the
      regex.
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@mailbox.org>
      Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
    • lxc-ls: check for ENOMEM and tweaking · 07385df5
      Christian Brauner authored
      - If lxc_container_new() fails we check for ENOMEM and if so goto out. If
        ENOMEM is not set we will simply continue. The same goes for the call to
        regcomp() but instead of checking for ENOMEM we need to check for REG_ESPACE.
      
      - Tweaking: Since lxc-ls might have to gather a lot of containers and I don't
        know if compilers will always optimize this let's move *some* variable
        declarations outside of the loop when it does not hinder readability
      
      - Set ls_nesting to 0 initially. Otherwise users will always see nested
        containers printed.
      
      - ls_get() gains an argument char **lockpath which is a string pointing us to
        the lock we put under /run/lxc/lock/.../... so that we can remove the lock
        when we no longer need it. To avoid pointless memory allocation in each new
        recursion level we share lockpath amongst all non-fork()ing recursive call to
        ls_get().  As it is not guaranteed that realloc() does not do any memory
        moving when newlen == len_lockpath, we give ls_get() an additional argument
        size_t len_lockpath). Every time we have a non-fork()ing recursive call to
        ls_get() we check if newlen > len_lockpath and only then do we
        realloc(*lockpath, newlen * 2) a reasonable chunk of memory (as the path will
        keep growing) and set len_lockpath = newlen * 2 to pass to the next
        non-fork()ing recursive call to ls_get().
        To avoid keeping a variable char *lockpath in main() which serves no purpose
        whatsoever and might be abused later we use a compound literal
        &(char *){NULL} which gives us an anonymous pointer which we can use for
        memory allocation in ls_get() for lockpath. We can conveniently free() it in
        ls_get() when the nesting level parameter lvl == 0 after exiting the loop.
        The advantage is that the variable is only accessible within ls_get() and not
        in main() while at the same time giving us an easy way to share lockpath
        amongst all non-fork()ing recursive calls to ls_get().
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@mailbox.org>
      Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
    • Revert "lxc-ls: check for ENOMEM and tweaking" · a8459b91
      Stéphane Graber authored
      This reverts commit 7f3c1cf2.
    • Revert "lxc-ls: Restore old [filter] behaviour" · adbc2d33
      Stéphane Graber authored
      This reverts commit e4434e0f.
    • lxc-ls: Restore old [filter] behaviour · e4434e0f
      Christian Brauner authored
      In the Python implementation users could pass a regex without a parameter flag
      as additional argument on the command line. The C implementation gained the
      flag -r/--regex for this. To not irritate users we restore the old behaviour
      and additionally rename -r/--regex to --filter to allow eplicitly passing the
      regex.
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@mailbox.org>
      Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
    • lxc-ls: check for ENOMEM and tweaking · 7f3c1cf2
      Christian Brauner authored
      - If lxc_container_new() fails we check for ENOMEM and if so goto out. If
        ENOMEM is not set we will simply continue. The same goes for the call to
        regcomp() but instead of checking for ENOMEM we need to check for REG_ESPACE.
      
      - Tweaking: Since lxc-ls might have to gather a lot of containers and I don't
        know if compilers will always optimize this, let's move *some* variable
        declarations outside of the loop when it does not hinder readability.
      
      - Set ls_nesting to 0 initially. Otherwise users will always see nested
        containers printed.
      
      - ls_get() gains an argument char **lockpath which is a string pointing us to
        the lock we put under /run/lxc/lock/.../... so that we can remove the lock
        when we no longer need it. To avoid pointless memory allocation in each new
        recursion level, we share lockpath amongst all non-fork()ing recursive calls
        to ls_get().  As it is not guaranteed that realloc() does not do any memory
        moving when newlen == len_lockpath, we give ls_get() an additional argument
        size_t len_lockpath). Every time we have a non-fork()ing recursive call to
        ls_get() we check if newlen > len_lockpath and only then do we
        realloc(*lockpath, newlen * 2) a reasonable chunk of memory (as the path will
        keep growing) and set len_lockpath = newlen * 2 to pass to the next
        non-fork()ing recursive call to ls_get().
        To avoid keeping a variable char *lockpath in main() which serves no purpose
        whatsoever and might be abused later we use a compound literal
        &(char *){NULL} which gives us an anonymous pointer. This pointer we can use
        for memory allocation in ls_get() for lockpath. We can conveniently free() it
        in ls_get() when the nesting level parameter lvl == 0 after exiting the loop.
        The advantage is that the variable is only accessible within ls_get() and not
        in main() while at the same time giving us an easy way to share lockpath
        amongst all non-fork()ing recursive calls to ls_get().
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@mailbox.org>
      Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
    • update overlayfs and aufs in lxc.container.conf · 280d2379
      Christian Brauner authored
      Explain that multiple /lower layers can be used.
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@mailbox.org>
      Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
    • aufs: support multiple lower layers · 410d0f6e
      Christian Brauner authored
      Do it in a safe way by using strstr() to check for the substring ":/" should
      ':' be part of a pathname.
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@mailbox.org>
      Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
    • lxc.rootfs: support multiple lower layers · 9208af16
      Christian Brauner authored
      Do it in a safe way by using strstr() to check for the substring ":/" should
      ':' be part of a pathname. This should be a safer implementation than the one
      originally suggested in #547.
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@mailbox.org>
      Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
    • mount_proc_if_needed: only safe mount when rootfs is defined · f267d666
      Bogdan Purcareata authored
      The safe_mount function was introduced in order to address CVE-2015-1335,
      one of the vulnerabilities being a mount with a symlink for the
      destination path. In scenarios such as lxc-execute with no rootfs, the
      destination path is the host /proc, which is previously mounted by the
      host, and is unmounted and mounted again in a new set of namespaces,
      therefore eliminating the need to check for it being a symlink.
      
      Mount the rootfs normally if the rootfs is NULL, keep the safe mount
      only for scenarios where a different rootfs is defined.
      Signed-off-by: 's avatarBogdan Purcareata <bogdan.purcareata@nxp.com>
      Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
    • Adapt manpage for lxc-ls to new C implementation · 37cf83ea
      Christian Brauner authored
      - explain new numeric argument to --nesting
      - include common options as lxc-ls now uses the standard lxc parser
      - add history section and update authors
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@mailbox.org>
      Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>