]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
8 years agoNULL pointer deference if nlmsg_reserve() returns NULL for ifi
Wim Coekaerts [Tue, 29 Dec 2015 06:25:58 +0000 (22:25 -0800)] 
NULL pointer deference if nlmsg_reserve() returns NULL for ifi

nlmsg_reserve() might return NULL

        if (nlmsg_len + tlen > nlmsg->cap)
                return NULL;

Also set err = -ENOMEM where appropriate

Signed-off-by: Wim Coekaerts <wim.coekaerts@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
8 years agoDocumenting valueless lxc.cap.drop behaviour
Marko Hauptvogel [Sun, 3 Jan 2016 22:20:47 +0000 (23:20 +0100)] 
Documenting valueless lxc.cap.drop behaviour

From b24b0e16848fbb93402a08efa3950cd59272b8da Mon Sep 17 00:00:00 2001
From: Marko Hauptvogel <marko.hauptvogel@googlemail.com>
Date: Sun, 3 Jan 2016 23:07:19 +0100
Subject: [PATCH] Documenting valueless lxc.cap.drop behaviour

Undocummented behaviour since 7d0eb87.

Signed-off-by: Marko Hauptvogel <marko.hauptvogel@googlemail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agofix buffer overflow in ifaddrs.c
tw19881113@gmail.com [Wed, 30 Dec 2015 07:24:43 +0000 (15:24 +0800)] 
fix buffer overflow in ifaddrs.c

jenkins: ok to test

Signed-off-by: Tw <tw19881113@gmail.com>
8 years agopython-lxc: Call PyOS_AfterFork after attaching to a container
Danil Osherov [Thu, 24 Dec 2015 13:54:19 +0000 (16:54 +0300)] 
python-lxc: Call PyOS_AfterFork after attaching to a container

As lxc_attach() calls fork() PyOS_AfterFork should be called in the new
process if the Python interpreter will continue to be used.

Signed-off-by: Danil Osherov <shindo@yandex-team.ru>
8 years agoFix swap calculation
Eva Charlotte Mayer [Wed, 23 Dec 2015 12:15:26 +0000 (13:15 +0100)] 
Fix swap calculation

Signed-off-by: Eva Charlotte Mayer <eva-charlotte.mayer@posteo.de>
8 years agoRefactoring conditional directives.
Wesley M [Tue, 15 Dec 2015 15:47:22 +0000 (10:47 -0500)] 
Refactoring conditional directives.

Signed-off-by: Wesley Marques <wesleymr.27@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agolxc-checkconfig: remove zgrep dependency
Andre McCurdy [Fri, 11 Dec 2015 20:35:55 +0000 (12:35 -0800)] 
lxc-checkconfig: remove zgrep dependency

zgrep is a script provided by the 'gzip' package, which may not be
installed on embedded systems etc which use busybox instead of the
standard full-featured utilities.

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
8 years agoReturn immediately in save_phys_nics if not run as root
Li Qiu [Fri, 11 Dec 2015 05:54:10 +0000 (07:54 +0200)] 
Return immediately in save_phys_nics if not run as root
Physical nic is not instantiated in lxc_create_network

Signed-off-by: Li Qiu <li.qiu@nomovok.com>
8 years agoFix seccomp profile on attach of undefined container
Stéphane Graber [Thu, 10 Dec 2015 23:58:58 +0000 (18:58 -0500)] 
Fix seccomp profile on attach of undefined container

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
8 years agoUpdate get_item test after the lxc.mount.entry fix
Stéphane Graber [Thu, 10 Dec 2015 04:45:26 +0000 (23:45 -0500)] 
Update get_item test after the lxc.mount.entry fix

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
8 years agofix 'lxc.mount.entry' key when clearing unexpanded config
Serge Hallyn [Thu, 10 Dec 2015 02:12:41 +0000 (02:12 +0000)] 
fix 'lxc.mount.entry' key when clearing unexpanded config

Closes #712

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoprune_init_cgroup: don't dereference NULL
Serge Hallyn [Sat, 5 Dec 2015 00:24:55 +0000 (18:24 -0600)] 
prune_init_cgroup: don't dereference NULL

This is to avoid:

https://errors.ubuntu.com/problem/d640a68bf7343705899d7ca8c6bc070d477cd845

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoConditional compilation for ARM and PPC
Christian Brauner [Thu, 3 Dec 2015 18:24:40 +0000 (19:24 +0100)] 
Conditional compilation for ARM and PPC

Check if symbols SCMP_ARCH_ARM and SCMP_ARCH_PPC are defined.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
8 years agoseccomp: support 32-bit arm on arm64, and 32-bit ppc on ppc64
Serge Hallyn [Wed, 2 Dec 2015 22:42:36 +0000 (22:42 +0000)] 
seccomp: support 32-bit arm on arm64, and 32-bit ppc on ppc64

Generally we enforce that a [arch] seccomp section can only be used on [arch].
However, on amd64 we allow [i386] sections for i386 containers, and there we
also take [all] sections and apply them for both 32- and 64-bit.

Do that also for ppc64 and arm64.  This allows seccomp-protected armhf
containers to run on arm64.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoapparmor: support lxc.aa_profile = unchanged
Serge Hallyn [Wed, 25 Nov 2015 20:45:08 +0000 (20:45 +0000)] 
apparmor: support lxc.aa_profile = unchanged

In which case lxc will not update the apparmor profile at all.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agolxc: let lxc-start support wlan phys
fli [Tue, 1 Dec 2015 11:17:29 +0000 (19:17 +0800)] 
lxc: let lxc-start support wlan phys

The commit: e5848d395cb <netdev_move_by_index: support wlan> only
made netdev_move_by_name support wlan, instead of netdev_move_by_index.

Given netdev_move_by_name is a wrapper of netdev_move_by_index, so here
replacing all of the call to lxc_netdev_move_by_index with lxc_netdev_move_by_name
to let lxc-start support wlan phys.

Signed-off-by: fupan li <fupan.li@windriver.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
8 years agodebian: Fix container creation on missing cache
Stéphane Graber [Fri, 20 Nov 2015 05:34:09 +0000 (00:34 -0500)] 
debian: Fix container creation on missing cache

This is currently breaking our daily image builds which happen in a
perfectly clean environment without a Debian keyring and without
anything in /var/cache/lxc

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agolxc_container struct: add comment about moving member fns
Serge Hallyn [Wed, 18 Nov 2015 05:05:37 +0000 (23:05 -0600)] 
lxc_container struct: add comment about moving member fns

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoRevert "seccomp: handle inverted arch"
Serge Hallyn [Tue, 17 Nov 2015 20:01:04 +0000 (14:01 -0600)] 
Revert "seccomp: handle inverted arch"

It breaks container starts.

This reverts commit 473ebc77d6762c2ec49fe59983dabc04f695fd01.

8 years agoBetter handle preserve_ns behavior
Serge Hallyn [Tue, 17 Nov 2015 18:59:05 +0000 (12:59 -0600)] 
Better handle preserve_ns behavior

Commit b6b2b194a8 preserves the container's namespaces for
possible later use in stop hook.  But some kernels don't have
/proc/pid/ns/ns for all the namespaces we may be interested in.
So warn but continue if this is the case.

Implement stgraber's suggested semantics.

 - User requests some namespaces be preserved:
    - If /proc/self/ns is missing => fail (saying kernel misses setns)
    - If /proc/self/ns/<namespace> entry is missing => fail (saying kernel misses setns for <namespace>)
 - User doesn't request some namespaces be preserved:
    - If /proc/self/ns is missing => log an INFO message (kernel misses setns) and continue
    - If /proc/self/ns/<namespace> entry is missing => log an INFO message (kernel misses setns for <namespace>) and continue

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoseccomp: handle inverted arch
Serge Hallyn [Thu, 12 Nov 2015 23:22:48 +0000 (17:22 -0600)] 
seccomp: handle inverted arch

lxc uses uname to check the kernel version.  Seccomp respects userspace.  In the case
of 32-bit userspace on 64-bit kernel, this was a bad combination.

When we run into that case, make sure that the compat seccomp context is 32-bit, and
the lxc->seccomp_ctx is the 64-bit.

Closes #654

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoFetch Debian archive GPG keyrings when they're not available
Virgil Dupras [Tue, 10 Nov 2015 02:23:51 +0000 (21:23 -0500)] 
Fetch Debian archive GPG keyrings when they're not available

When running the debian template on a non-debian host, it's usual not to
have debian-archive-keyring.gpg. When that happens, we skip the
signature checking of the release, which is dangerous because it's made over
HTTP.

This commit adds automatic fetching of Debian release keys.

Strongly related to #409

Signed-off-by: Virgil Dupras <hsoft@hardcoded.net>
8 years agoUse /usr/bin/env python3 instead of /usr/bin/python3 project-wide
Fox Wilson [Tue, 10 Nov 2015 20:00:25 +0000 (15:00 -0500)] 
Use /usr/bin/env python3 instead of /usr/bin/python3 project-wide

This fixes invocations of certain commands when python3 is installed in
a nonstandard path (/usr/local/bin, for example).

Signed-off-by: Fox Wilson <2016fwilson@tjhsst.edu>
8 years agocoverity: avoid null pointer dereference in cgmanager
Serge Hallyn [Mon, 9 Nov 2015 20:19:12 +0000 (14:19 -0600)] 
coverity: avoid null pointer dereference in cgmanager

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoubuntu-cloud: Various fixes
Stéphane Graber [Thu, 12 Nov 2015 17:44:38 +0000 (12:44 -0500)] 
ubuntu-cloud: Various fixes

 - Update list of supported releases
 - Make the fallback release trusty
 - Don't specify the compression algorithm (use auto-detection) so that
   people passing tarballs to the template don't see regressions.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agodoc: change "-t" option of lxc-create(1) to being required
KATOH Yasufumi [Wed, 26 Nov 2014 07:20:54 +0000 (16:20 +0900)] 
doc: change "-t" option of lxc-create(1) to being required

* fix "reg" to "req" in English (fix for commit b8683fe)
* change "opt" to "req" in Japanese

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agochange version to 1.0.8 in configure.ac lxc-1.0.8
Stéphane Graber [Mon, 9 Nov 2015 20:48:29 +0000 (15:48 -0500)] 
change version to 1.0.8 in configure.ac

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoarch template: Fix systemd-sysctl service
Jakub Sztandera [Fri, 30 Oct 2015 11:05:44 +0000 (12:05 +0100)] 
arch template: Fix systemd-sysctl service

The systemd-sysctl service includes condition that /proc/sys/ has to be read-write.
In lxc only /proc/sys/net/ is read-write which causes the condition to fail and service not to run.
This patch changes the check to /proc/sys/net/ and makes the service apply only rules that are in net tree.

Signed-off-by: Jakub Sztandera <kubuxu@gmail.com>
9 years agoSimplify function
Christian Brauner [Sun, 25 Oct 2015 21:59:45 +0000 (22:59 +0100)] 
Simplify function

Instead of duplicating the cleanup-code, once for success and once for failure,
simply keep a variable fret which is -1 in the beginning and gets set to 0 on
success or stays -1 on failure.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoParse rootfs->path
Christian Brauner [Thu, 22 Oct 2015 07:18:15 +0000 (09:18 +0200)] 
Parse rootfs->path

The mount_entry_overlay_dirs() and mount_entry_aufs_dirs() functions create
workdirs and upperdirs for overlay and aufs lxc.mount.entry entries. They try
to make sure that the workdirs and upperdirs can only be created under the
containerdir (e.g. /path/to/the/container/CONTAINERNAME). In order to do this
the right hand side of

                if ((strncmp(upperdir, lxcpath, dirlen) == 0) && (strncmp(upperdir, rootfs->path, rootfslen) != 0))

was thought to check if the rootfs->path is not present in the workdir and
upperdir mount options. But the current check is bogus since it will be
trivially true whenever the container is a block-dev or overlay or aufs backed
since the rootfs->path will then have a form like e.g.

        overlayfs:/some/path:/some/other/path

This patch adds the function ovl_get_rootfs_dir() which parses rootfs->path by
searching backwards for the first occurrence of the delimiter pair ":/". We do
not simply search for ":" since it might be used in path names. If ":/" is not
found we assume the container is directory backed and simply return
strdup(rootfs->path).

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoIgnore trailing /init.scope in init cgroups
Serge Hallyn [Thu, 15 Oct 2015 18:56:17 +0000 (18:56 +0000)] 
Ignore trailing /init.scope in init cgroups

The lxc monitor does not store the container's cgroups, rather it
recalculates them whenever needed.

Systemd moves itself into a /init.scope cgroup for the systemd
controller.

It might be worth changing that (by storing all cgroup info in the
lxc_handler), but for now go the hacky route and chop off any
trailing /init.scope.

I definately thinkg we want to switch to storing as that will be
more bullet-proof, but for now we need a quick backportable fix
for systemd 226 guests.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoMake mount_entry_create_*_dirs() more robust
Christian Brauner [Wed, 7 Oct 2015 17:34:02 +0000 (19:34 +0200)] 
Make mount_entry_create_*_dirs() more robust

The mount_entry_create_*_dirs() functions currently assume that the rootfs of
the container is actually named "rootfs". This has the consequence that

del = strstr(lxcpath, "/rootfs");
if (!del) {
free(lxcpath);
lxc_free_array((void **)opts, free);
return -1;
}
*del = '\0';

will return NULL when the rootfs of a container is not actually named "rootfs".
This means the we return -1 and do not create the necessary upperdir/workdir
directories required for the overlay/aufs mount to work. Hence, let's not make
that assumption. We now pass lxc_path and lxc_name to
mount_entry_create_*_dirs() and create the path directly. To prevent failure we
also have mount_entry_create_*_dirs() check that lxc_name and lxc_path are not
empty when they are passed in.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoonly re-open fds if stdin is a tty
Serge Hallyn [Fri, 30 Oct 2015 05:14:12 +0000 (05:14 +0000)] 
only re-open fds if stdin is a tty

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoInit error_num to 1
Stéphane Graber [Thu, 5 Nov 2015 18:44:30 +0000 (13:44 -0500)] 
Init error_num to 1

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agolxc-ubuntu-cloud: Never exit 0 when no container is created
Stéphane Graber [Thu, 5 Nov 2015 18:37:03 +0000 (13:37 -0500)] 
lxc-ubuntu-cloud: Never exit 0 when no container is created

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agodon't close std* fd if opentty fails
Serge Hallyn [Fri, 30 Oct 2015 04:51:14 +0000 (23:51 -0500)] 
don't close std* fd if opentty fails

We didn't do it before, and it makes testcases fail.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agolxc-usernsexec: reopen fds 0,1,2 separately
Serge Hallyn [Wed, 14 Oct 2015 03:13:47 +0000 (03:13 +0000)] 
lxc-usernsexec: reopen fds 0,1,2 separately

lxc-usernsexec was using fd 0 and reopening it as 0,1,2 for
the new task.  If doing "lxc-usernsexec .. < script" this
will corrupt the file 'script'.

Reported-by: Fiedler Roman <Roman.Fiedler@ait.ac.at>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoubuntu-cloud: Replace .tar.gz by .tar.xz and don't auto-generate missing tarballs
Stéphane Graber [Wed, 14 Oct 2015 02:07:04 +0000 (19:07 -0700)] 
ubuntu-cloud: Replace .tar.gz by .tar.xz and don't auto-generate missing tarballs

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agolxc-create: Require --template be passed
Stéphane Graber [Fri, 7 Mar 2014 20:29:12 +0000 (15:29 -0500)] 
lxc-create: Require --template be passed

It's often been reported that the behavior of lxc-create without -t is a
bit confusing. This change makes lxc-create require the --template
option and introduces a new "none" special value which when set will
fallback to the old template-less behavior.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoapparmor: Sync with current git master
Stéphane Graber [Wed, 14 Oct 2015 20:50:14 +0000 (13:50 -0700)] 
apparmor: Sync with current git master

This makes stable-1.0, stable-1.1 and master all be in sync with regard
to apparmor. This has the nice added benefit of fixing an apparmor
regression with /dev/pts handling in some older kernels.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agopreserve container namespace
Wolfgang Bumiller [Tue, 6 Oct 2015 08:01:02 +0000 (10:01 +0200)] 
preserve container namespace

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agostart.c:preserve_ns: added pid parameter
Wolfgang Bumiller [Tue, 6 Oct 2015 08:01:01 +0000 (10:01 +0200)] 
start.c:preserve_ns: added pid parameter

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoMake overlayfs mounts work directly
Christian Brauner [Tue, 6 Oct 2015 18:38:13 +0000 (20:38 +0200)] 
Make overlayfs mounts work directly

When users wanted to mount overlay directories with lxc.mount.entry they had to
create upperdirs and workdirs beforehand in order to mount them. To create it
for them we add the functions mount_entry_create_overlay_dirs() and
mount_entry_create_aufs_dirs() which do this for them. User can now simply
specify e.g.:

        lxc.mount.entry = /lower merged overlay lowerdir=/lower,upper=/upper,workdir=/workdir,create=dir

and /upper and /workdir will be created for them. /upper and /workdir need to
be absolute paths to directories which are created under the containerdir (e.g.
under $lxcpath/CONTAINERNAME/). Relative mountpoints, mountpoints outside the
containerdir, and mountpoints within the container's rootfs are ignored. (The
latter *might* change in the future should it be considered safe/useful.)

Specifying

        lxc.mount.entry = /lower merged overlay lowerdir=/lower:/lower2,create=dir

will lead to a read-only overlay mount in accordance with the
kernel-documentation.

Specifying

        lxc.mount.entry = /lower merged overlay lowerdir=/lower,create=dir

will fail when no upperdir and workdir options are given.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoFix the type of i in lxc_mount_auto_mounts
Stéphane Graber [Mon, 5 Oct 2015 11:12:17 +0000 (12:12 +0100)] 
Fix the type of i in lxc_mount_auto_mounts

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agolxc_mount_auto_mounts: fix weirdness
Serge Hallyn [Sat, 3 Oct 2015 21:52:16 +0000 (21:52 +0000)] 
lxc_mount_auto_mounts: fix weirdness

The default_mounts[i].destination is never NULL except in the last
'stop here' entry.  Coverity doesn't know about that and so is spewing
a warning.  In any case, let's add a more stringent check in case someone
accidentally adds a NULL there later.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add the note related mount in Japanese lxc.container.conf(5)
KATOH Yasufumi [Wed, 30 Sep 2015 06:19:27 +0000 (15:19 +0900)] 
doc: Add the note related mount in Japanese lxc.container.conf(5)

Update for commit 592fd47

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agolxc-test-symlink: add a test using absolute symlink
Serge Hallyn [Wed, 30 Sep 2015 18:01:01 +0000 (18:01 +0000)] 
lxc-test-symlink: add a test using absolute symlink

This would have caught the regression last night.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoseccomp: add aarch64 support
Bogdan Purcareata [Thu, 1 Oct 2015 08:19:37 +0000 (08:19 +0000)] 
seccomp: add aarch64 support

Enable aarch64 seccomp support for LXC containers running on ARM64
architectures. Tested with libseccomp 2.2.0 and the default seccomp
policy example files delivered with the LXC package.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agolxc-start-ephemeral: Parse passwd directly
Colin Watson [Wed, 30 Sep 2015 12:37:10 +0000 (13:37 +0100)] 
lxc-start-ephemeral: Parse passwd directly

On Ubuntu 15.04, lxc-start-ephemeral's call to pwd.getpwnam always
fails.  While I haven't been able to prove it or track down an exact
cause, I strongly suspect that glibc does not guarantee that you can
call NSS functions after a context switch without re-execing.  (Running
"id root" in a subprocess from the same point works fine.)

It's safer to use getent to extract the relevant line from the passwd
file and parse it directly.

Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
9 years agoDefine O_PATH and O_NOFOLLOW for Android
Stéphane Graber [Tue, 29 Sep 2015 18:59:28 +0000 (14:59 -0400)] 
Define O_PATH and O_NOFOLLOW for Android

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agolxc-alpine: use getopt to parse options
Kaarle Ritvanen [Mon, 28 Sep 2015 11:51:21 +0000 (14:51 +0300)] 
lxc-alpine: use getopt to parse options

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agolxc-alpine: avoid GNU BRE extensions for better portability
Kaarle Ritvanen [Mon, 28 Sep 2015 11:49:14 +0000 (14:49 +0300)] 
lxc-alpine: avoid GNU BRE extensions for better portability

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoFree allocated memory on failure (v2)
Christian Brauner [Mon, 28 Sep 2015 11:33:33 +0000 (13:33 +0200)] 
Free allocated memory on failure (v2)

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoAdd CAP_BLOCK_SUSPEND
Christian Brauner [Sun, 27 Sep 2015 10:27:07 +0000 (12:27 +0200)] 
Add CAP_BLOCK_SUSPEND

CAP_BLOCK_SUSPEND (since Linux 3.5)
    Employ features that can block system suspend (epoll(7) EPOLLWAKEUP, /proc/sys/wake_lock).

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoAdd CAP_AUDIT_READ
Christian Brauner [Sun, 27 Sep 2015 10:16:54 +0000 (12:16 +0200)] 
Add CAP_AUDIT_READ

CAP_AUDIT_READ (since Linux 3.16)
    Allow reading the audit log via a multicast netlink socket.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agolxc-debian: We should only check the kernel architecture.
Stéphane Graber [Mon, 28 Sep 2015 19:43:10 +0000 (15:43 -0400)] 
lxc-debian: We should only check the kernel architecture.

The dpkg architecture isn't relevant to LXC, only the kernel arch is.

Signed-off-by: Gergely Szasz <szaszg@hu.inter.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agocoverity: drop second (redundant) block
Serge Hallyn [Sat, 26 Sep 2015 19:44:40 +0000 (14:44 -0500)] 
coverity: drop second (redundant) block

Don't proceed to try the mount if we failed to create the
target if it didn't exist.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agolxc-test-symlink: Background the containers
Stéphane Graber [Tue, 29 Sep 2015 16:35:25 +0000 (12:35 -0400)] 
lxc-test-symlink: Background the containers

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoCVE-2015-1335: Protect container mounts against symlinks
Serge Hallyn [Mon, 31 Aug 2015 17:57:20 +0000 (12:57 -0500)] 
CVE-2015-1335: Protect container mounts against symlinks

When a container starts up, lxc sets up the container's inital fstree
by doing a bunch of mounting, guided by the container configuration
file.  The container config is owned by the admin or user on the host,
so we do not try to guard against bad entries.  However, since the
mount target is in the container, it's possible that the container admin
could divert the mount with symbolic links.  This could bypass proper
container startup (i.e. confinement of a root-owned container by the
restrictive apparmor policy, by diverting the required write to
/proc/self/attr/current), or bypass the (path-based) apparmor policy
by diverting, say, /proc to /mnt in the container.

To prevent this,

1. do not allow mounts to paths containing symbolic links

2. do not allow bind mounts from relative paths containing symbolic
links.

Details:

Define safe_mount which ensures that the container has not inserted any
symbolic links into any mount targets for mounts to be done during
container setup.

The host's mount path may contain symbolic links.  As it is under the
control of the administrator, that's ok.  So safe_mount begins the check
for symbolic links after the rootfs->mount, by opening that directory.

It opens each directory along the path using openat() relative to the
parent directory using O_NOFOLLOW.  When the target is reached, it
mounts onto /proc/self/fd/<targetfd>.

Use safe_mount() in mount_entry(), when mounting container proc,
and when needed.  In particular, safe_mount() need not be used in
any case where:

1. the mount is done in the container's namespace
2. the mount is for the container's rootfs
3. the mount is relative to a tmpfs or proc/sysfs which we have
   just safe_mount()ed ourselves

Since we were using proc/net as a temporary placeholder for /proc/sys/net
during container startup, and proc/net is a symbolic link, use proc/tty
instead.

Update the lxc.container.conf manpage with details about the new
restrictions.

Finally, add a testcase to test some symbolic link possibilities.

Reported-by: Roman Fiedler
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
ACked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agocmds: fix abstract socket length problem
Tycho Andersen [Fri, 25 Sep 2015 22:45:59 +0000 (16:45 -0600)] 
cmds: fix abstract socket length problem

Since we want to use null-terminated abstract sockets, let's compute the length
of them correctly.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add the description of common options in lxc-destroy(1)
KATOH Yasufumi [Fri, 28 Aug 2015 07:51:06 +0000 (16:51 +0900)] 
doc: Add the description of common options in lxc-destroy(1)

* Remove '-P' option, and common options (including '-P' option)
* Add long option for '-f'
* Improve Japanese translation

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoFix indentation
Stéphane Graber [Mon, 21 Sep 2015 20:25:47 +0000 (16:25 -0400)] 
Fix indentation

I've noticed that a bunch of the code we've included over the past few
weeks has been using 8-spaces rather than tabs, making it all very hard
to read depending on your tabstop setting.

This commit attempts to revert all of that back to proper tabs and fix a
few more cases I've noticed here and there.

No functional changes are included in this commit.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoovl_rsync: make sure to umount
Serge Hallyn [Mon, 21 Sep 2015 19:33:23 +0000 (19:33 +0000)] 
ovl_rsync: make sure to umount

Otherwise the kernel will umount when it gets around to it, but
that on lxc_destroy we may race with it and fail the rmdir of
the overmounted (BUSY) rootfs.

This makes lxc-test-snapshot pass for me again.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agooverlayfs_mount: create delta dir if it doesn't exist
Serge Hallyn [Mon, 21 Sep 2015 17:09:25 +0000 (17:09 +0000)] 
overlayfs_mount: create delta dir if it doesn't exist

(This *should* fix the lxc-test-snapshot testcase, but doesn't seem
to by itself.)

If it doesn't exist, we may as well start with an empty one.  This
is needed when creating an overlayfs snapshot.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agolxc_rmdir_onedev: don't fail if path doesn't exist
Serge Hallyn [Mon, 21 Sep 2015 17:01:10 +0000 (17:01 +0000)] 
lxc_rmdir_onedev: don't fail if path doesn't exist

We're asked to delete it, don't fail if it doesn't exist.

This stops lxc-destroy from failing when the container isn't fully
built.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agolxc-checkconfig: add some more config options
Tycho Andersen [Fri, 11 Sep 2015 18:45:33 +0000 (12:45 -0600)] 
lxc-checkconfig: add some more config options

Here's some more config options that we do actually require to be able to
boot containers.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agooverlayfs_clone: rsync the mounted rootfs
Serge Hallyn [Thu, 17 Sep 2015 17:26:12 +0000 (17:26 +0000)] 
overlayfs_clone: rsync the mounted rootfs

Closes #655

We can't rsync the delta as unpriv user because we can't create
the chardevs representing a whiteout.  We can however rsync the
rootfs and have the kernel create the whiteouts for us.

do_rsync: pass --delete

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoFix reallocation calculation
Christian Brauner [Mon, 21 Sep 2015 07:53:43 +0000 (09:53 +0200)] 
Fix reallocation calculation

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoAdd a nesting.conf which can be included to support nesting containers (v2)
Serge Hallyn [Thu, 3 Sep 2015 20:24:06 +0000 (20:24 +0000)] 
Add a nesting.conf which can be included to support nesting containers (v2)

Newer kernels have added a new restriction:  if /proc or /sys on the
host has files or non-empty directories which are over-mounted, and
there is no /proc which fully visible, then it assumes there is a
"security" reason for this.  It prevents anyone in a non-initial user
namespace from creating a new proc or sysfs mount.

To work around this, this patch adds a new 'nesting.conf' which can be
lxc.include'd from a container configuration file.  It adds a
non-overmounted mount of /proc and /sys under /dev/.lxc, so that the
kernel can see that we're not trying to *hide* things like /proc/uptime.
and /sys/devices/virtual/net.  If the host adds this to the config file
for container w1, then container w1 will support unprivileged child
containers.

The nesting.conf file also sets the apparmor profile to the with-nesting
variant, since that is required anyway.  This actually means that
supporting nesting isn't really more work than it used to be, just
different.  Instead of adding

lxc.aa_profile = lxc-container-default-with-nesting

you now just need to

lxc.include = /usr/share/lxc/config/nesting.conf

(Look, fewer characters :)

Finally, in order to maintain the current apparmor protections on
proc and sys, we make /dev/.lxc/{proc,sys} non-read/writeable.
We don't need to be able to use them, we're just showing the
kernel what's what.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add LXC-specific mount option in Japanese lxc.container.conf(5)
KATOH Yasufumi [Fri, 28 Aug 2015 06:35:50 +0000 (15:35 +0900)] 
doc: Add LXC-specific mount option in Japanese lxc.container.conf(5)

Add the description of optional, create=file/dir for lxc.mount.entry.
This is update for commit f5b67b3.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agocoverity: fix mount_entry_create_dir_file
Serge Hallyn [Fri, 4 Sep 2015 18:15:13 +0000 (13:15 -0500)] 
coverity: fix mount_entry_create_dir_file

First, fix use of uninitialized variable 'ret'.  Then, actually use
the value it returned in its caller.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoTear down network devices during container halt
Major Hayden [Wed, 2 Sep 2015 21:21:11 +0000 (16:21 -0500)] 
Tear down network devices during container halt

On very busy systems, some virtual network devices won't be destroyed after a
container halts.  This patch uses the lxc_delete_network() method to ensure
that network devices attached to the container are destroyed when the
container halts.

Without the patch, some virtual network devices are left over on the system
and must be removed with `ip link del <device>`.  This caused containers
with lxc.network.veth.pair to not be able to start.  For containers using
randomly generated virtual network device names, the old devices will hang
around on the bridge with their original MAC address.

Signed-off-by: Major Hayden <major@mhtx.net>
9 years agoinit: Support older apparmor
Stéphane Graber [Thu, 27 Aug 2015 19:25:08 +0000 (15:25 -0400)] 
init: Support older apparmor

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoFix grammar in some of the executables
Christian Brauner [Fri, 14 Aug 2015 18:24:05 +0000 (20:24 +0200)] 
Fix grammar in some of the executables
"NAME for name of the container" becomes "NAME of the container"

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoMake LXC_CLONE_KEEPNAME work
Christian Brauner [Fri, 14 Aug 2015 18:17:21 +0000 (20:17 +0200)] 
Make LXC_CLONE_KEEPNAME work

- Passing the LXC_CLONE_KEEPNAME flag to do_lxcapi_clone() was not respected and
  let to unexpected behaviour for e.g. lxc-clone. We wrap
  clear_unexp_config_line() and set_config_item_line() in an appropriate
  if-condition.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoSplit handle of lxc.mount* with 3 functions
Nicolas Cornu [Sat, 15 Aug 2015 22:52:44 +0000 (00:52 +0200)] 
Split handle of lxc.mount* with 3 functions

Signed-off-by: Nicolas Cornu <nicolac76@yahoo.fr>
9 years agoRefactor and factorize mount entries
Nicolas Cornu [Thu, 6 Aug 2015 08:37:15 +0000 (10:37 +0200)] 
Refactor and factorize mount entries

Signed-off-by: Nicolas Cornu <ncornu@aldebaran.com>
9 years agoFactorize handle of create=dir and create=file
Nicolas Cornu [Thu, 6 Aug 2015 08:35:16 +0000 (10:35 +0200)] 
Factorize handle of create=dir and create=file

Signed-off-by: Nicolas Cornu <ncornu@aldebaran.com>
9 years agoOnly use LOGPATH if lxcpath is unset or default
Michal Grzedzicki [Tue, 21 Jul 2015 08:29:00 +0000 (10:29 +0200)] 
Only use LOGPATH if lxcpath is unset or default

Signed-off-by: Michał Grzędzicki <lazy404@gmail.com>
9 years agopass on reboot flag and delete old veth on reboot
Wolfgang Bumiller [Mon, 27 Jul 2015 05:33:08 +0000 (07:33 +0200)] 
pass on reboot flag and delete old veth on reboot

When setting lxc.network.veth.pair to get a fixed interface
name the recreation of it after a reboot caused an EEXIST.
-) The reboot flag is now a three-state value. It's set to
1 to request a reboot, and 2 during a reboot until after
lxc_spawn where it is reset to 0.
-) If the reboot is set (!= 0) within instantiate_veth and
a fixed name is used, the interface is now deleted before
being recreated.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agolxc-autostart: Fix broken output
Stéphane Graber [Fri, 17 Jul 2015 18:35:15 +0000 (14:35 -0400)] 
lxc-autostart: Fix broken output

This fixes some typos, missing newlines and unflushed output leading to
duplicate entries when piped (similar to what we had in lxc-info).

Reported-by: Marc Gariépy
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodaemonized start: exit children on failure, don't return
Serge Hallyn [Thu, 11 Jun 2015 04:08:15 +0000 (23:08 -0500)] 
daemonized start: exit children on failure, don't return

When starting a daemonized container, only the original parent
thread should return to the caller.  The first forked child
immediately exits after forking, but the grandparent child
was in some places returning on error - causing a second instance
of the calling function.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
9 years agoFix creation of dev/mqueue and dev/shm on Gentoo
Dennis Schridde [Thu, 11 Jun 2015 13:21:19 +0000 (15:21 +0200)] 
Fix creation of dev/mqueue and dev/shm on Gentoo

The dev/mqueue and dev/shm directories do not exist when using lxc.autodev, thus they have to be created upon mount.

Signed-off-by: Dennis Schridde <devurandom@gmx.net>
9 years agoUpdate lxc-oracle.in
有张纸 [Thu, 11 Jun 2015 04:50:50 +0000 (12:50 +0800)] 
Update lxc-oracle.in

9 years agouniformly nullify std fds
Tycho Andersen [Wed, 10 Jun 2015 21:57:50 +0000 (21:57 +0000)] 
uniformly nullify std fds

In various places throughout the code, we want to "nullify" the std fds,
opening them to /dev/null or zero or so. Instead, let's unify this code and do
it in such a way that Coverity (probably) won't complain.

v2: use /dev/null for stdin as well
v3: add a comment about use of C's short circuiting
v4: axe comment, check errors on dup2, s/quiet/need_null_stdfds

Reported-by: Coverity
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agodetect whether cgmanager_list_controllers is available
Serge Hallyn [Wed, 3 Jun 2015 05:03:39 +0000 (05:03 +0000)] 
detect whether cgmanager_list_controllers is available

and don't use it if not. This fixes failure to build with older
cgmanager.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agolxc-destroy: remove btrfs subvolumes
Serge Hallyn [Tue, 28 Apr 2015 13:31:05 +0000 (13:31 +0000)] 
lxc-destroy: remove btrfs subvolumes

Doing this requires some btrfs functions from bdev to be used in
utils.c  Because utils.h is imported by lxc_init.c, I had to create
a new initutils.[ch] which are used by both lxc_init.c and utils.c
We could instead put the btrfs functions into utils.c, which would
be a shorter patch, but it really doesn't belong there.  So I went
the other way figuring there may be more such cases coming up of
fns in utils.c needing code from bdev.c which can't go into lxc_init.

Currently, if we detect a btrfs subvolume we just remove it.  The
st_dev on that dir is different, so we cannot detect if this is
bound in from another fs easily.  If we care, we should check
whether this is a mountpoint, this patch doesn't do that.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agocoverity: free 'result' in error case.
Serge Hallyn [Sun, 17 May 2015 12:30:57 +0000 (07:30 -0500)] 
coverity: free 'result' in error case.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoProperly free memory of sorted cgroup settings
Kien Truong [Mon, 6 Apr 2015 16:20:43 +0000 (17:20 +0100)] 
Properly free memory of sorted cgroup settings

We need to use lxc_list_for_each_safe, otherwise de-allocation
will fail with a list size bigger than 2. The pointer to the head
of the list also need freeing after we've freed all other elements
of the list.

Signed-off-by: Kien Truong <duckientruong@gmail.com>
9 years agoCheck malloc failure when sorting cgroup settings.
Kien Truong [Mon, 6 Apr 2015 16:05:20 +0000 (17:05 +0100)] 
Check malloc failure when sorting cgroup settings.

Signed-off-by: Kien Truong <duckientruong@gmail.com>
9 years agoSort the cgroup memory settings before applying.
Kien Truong [Sun, 5 Apr 2015 23:46:22 +0000 (23:46 +0000)] 
Sort the cgroup memory settings before applying.

Add a function to sort the cgroup settings before applying.
Currently, the function will put memory.memsw.limit_in_bytes after
memory.limit_in_bytes setting so the container will start
regardless of the order specified in the input. Fix #453

Signed-off-by: Kien Truong <duckientruong@gmail.com>
9 years agolxc-alpine: create /dev/shm before mounting
Natanael Copa [Fri, 24 Apr 2015 08:26:40 +0000 (10:26 +0200)] 
lxc-alpine: create /dev/shm before mounting

This is needed for lxc.autodev=1 to work.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoFix incomplete destruction of unprivileged ephemeral containers
Stéphane Graber [Mon, 6 Apr 2015 16:11:25 +0000 (12:11 -0400)] 
Fix incomplete destruction of unprivileged ephemeral containers

If an unprivileged ephemeral container is started as follows,

    lxc-start-ephemeral -o trusty -n test_ephemeral

Then an empty directory remains upon exit from the container,

    ~/.local/share/lxc/test_ephemeral/tmpfs/delta0

(The tmpfs filesystem is successfully unmounted, but we seem to lack
permission to delete the delta0 directory).

This issue arose following commits 4799a1e and dd2271e .

The following patch resolves the issue. It has been tested on ubuntu
14.04 with the lxc-daily ppa.
Since gmail screws up the formatting of the patch via line-wrapping
etc, please copy the patch from the issue-tracker rather than from
this email.

Signed-off by: Oleg Freedholm <overlayfs@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agolxc-destroy: actually work if underlying fs is overlayfs
Serge Hallyn [Mon, 16 Mar 2015 17:02:12 +0000 (17:02 +0000)] 
lxc-destroy: actually work if underlying fs is overlayfs

One of the 'features' of overlayfs is that depending on whether a file
is on the upper or lower dir you get back a different device from stat.
That breaks our lxc_rmdir_onedev.

So at lxc_rmdir_ondev check the device of the directory being deleted.
If it is overlayfs, then skip the device check.

Note this is unrelated to overlayfs snapshots - in those cases when you
delete a container, /var/lib/lxc/$container/ does not actually have an
overlayfs under it.  Rather, to reproduce this you would

sudo mkdir /opt/{lower,upper,workdir}
sudo mount -t overlayfs -o lower=/opt/lower,upper=/opt/upper,workdir=/opt/workdir \
lxc /var/lib/lxc
sudo lxc-create -t download -n c1 -- -d ubuntu -r trusty -a amd64
sudo lxc-destroy -n c1

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Tested-by: Marko Ratkaj <marko.ratkaj@sartura.hr>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agotemplates: gentoo.common: Add /dev/shm tmpfs mount entry
Markos Chandras [Thu, 12 Mar 2015 20:52:11 +0000 (20:52 +0000)] 
templates: gentoo.common: Add /dev/shm tmpfs mount entry

/dev/shm needs to be mounted as tmpfs. It's needed by python
and possibly other packages.

Signed-off-by: Markos Chandras <hwoarang@gentoo.org>
9 years agoFix lxc-create -h with absolute template path
Stéphane Graber [Wed, 28 Jan 2015 08:28:22 +0000 (09:28 +0100)] 
Fix lxc-create -h with absolute template path

Close #421

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoimprove "lxc-create -t debian -h" help text
Tomas Pospisek [Sun, 25 Jan 2015 15:27:10 +0000 (16:27 +0100)] 
improve "lxc-create -t debian -h" help text

- document environment variables
- add missing --packages switch to command line
- describe how to pass template options to lxc-create (since
  lxc-create -h doesn't tell you)
- render help text in the same pretty format as lxc-create does

Signed-off-by: Tomáš Posíšek <tpo_deb@sourcepole.ch>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agorpm: added dependency to lxc-libs to lxc package
Johannes Kastl [Fri, 23 Jan 2015 18:28:10 +0000 (19:28 +0100)] 
rpm: added dependency to lxc-libs to lxc package

Ensures matching versions of lxc and lxc-libs being installed

Signed-off-by: Johannes Kastl <mail@ojkastl.de>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoBug #158: Deletion of unnecessary checks before a few calls of LXC functions
Markus Elfring [Sat, 24 Jan 2015 19:38:49 +0000 (20:38 +0100)] 
Bug #158: Deletion of unnecessary checks before a few calls of LXC functions

The following functions return immediately if a null pointer was passed.
* container_destroy
* lxc_cgroup_process_info_free_and_remove
* lxc_cgroup_put_meta
* toss_list

It is therefore not needed that a function caller repeats a corresponding check.

This issue was fixed by using the software Coccinelle 1.0.0-rc23.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoBug #158: Deletion of unnecessary checks before calls of the function "free"
Markus Elfring [Sat, 24 Jan 2015 18:55:36 +0000 (19:55 +0100)] 
Bug #158: Deletion of unnecessary checks before calls of the function "free"

The function "free" is documented in the way that no action shall occur for
a passed null pointer. It is therefore not needed that a function caller
repeats a corresponding check.
http://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first

This issue was fixed by using the software Coccinelle 1.0.0-rc23.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>