]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
9 years agoBetter handle preserve_ns behavior 700/head
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>
9 years agoMerge pull request #692 from fwilson42/master
Stéphane Graber [Tue, 17 Nov 2015 16:43:56 +0000 (11:43 -0500)] 
Merge pull request #692 from fwilson42/master

lxc-ls: use /usr/bin/env to find an appropriate python3 to run

9 years agoMerge pull request #693 from hsoft/debian-keyring
Stéphane Graber [Tue, 17 Nov 2015 16:43:19 +0000 (11:43 -0500)] 
Merge pull request #693 from hsoft/debian-keyring

Fetch Debian archive GPG keyrings when they're not available

9 years agoMerge pull request #697 from hallyn/2015-11-12/seccomp
Stéphane Graber [Tue, 17 Nov 2015 16:42:14 +0000 (11:42 -0500)] 
Merge pull request #697 from hallyn/2015-11-12/seccomp

seccomp: handle inverted arch

9 years agoclone: clear the rootfs out of unexpanded config
Serge Hallyn [Wed, 11 Nov 2015 17:13:25 +0000 (17:13 +0000)] 
clone: clear the rootfs out of unexpanded config

Closes #694

When we start cloning container c1 to c2, we first save c1's
configuration in c2's as a starting point.  We long ago cleared
out the lxc.rootfs entry before saving it, so that if we are
killed before we update the rootfs, c2's rootfs doesn't point
to c1's.  Because then lxc-destroy -n c2 would delete c1's rootfs.

But when we introduced the unexpanded_config, we didn't update
this code to clear the rootfs out of the unexpanded_config, which
is what now actually gets saved in write_config().

Do so.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoImprove coding style and coding conventions
Christian Brauner [Tue, 10 Nov 2015 16:52:36 +0000 (17:52 +0100)] 
Improve coding style and coding conventions

Local variables should not have the same name as global variables to avoid
confusion.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoFix mode when creating temporary directory
Christian Brauner [Mon, 9 Nov 2015 20:47:28 +0000 (21:47 +0100)] 
Fix mode when creating temporary directory

When we create a random container directory with mkdtemp() we set the mode to
0770 otherwise do_lxcapi_clone() will complain about not being able to create
the config.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoUse correct return when clone fails
Christian Brauner [Mon, 9 Nov 2015 20:47:27 +0000 (21:47 +0100)] 
Use correct return when clone fails

When the clone failed we tried to destroy the container. This will lead to a
segfault. Instead simply return -1. Also move the call to free_mnts() after the
put label to free the user specified mounts even when we just goto put.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoAdd manpage for lxc-copy
Christian Brauner [Thu, 12 Nov 2015 20:11:30 +0000 (21:11 +0100)] 
Add manpage for lxc-copy

(A trivial fix for lxc-copy is included.)

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
9 years agoAdd lxc-copy executable
Christian Brauner [Fri, 6 Nov 2015 10:59:59 +0000 (11:59 +0100)] 
Add lxc-copy executable

This is a complete reimplementation of lxc-clone and lxc-start-ephemeral.
lxc-copy merges the functionalities of lxc-clone + lxc-start-ephemeral.

(1) Cloning containers:

(a) as copy:

lxc-copy -n aa -N bb

(b) as snapshot:

lxc-copy -n aa -N bb -s

(2) Renaming containers:

lxc-copy -n aa -N bb -R

(3) Starting ephemeral containers:

Ephemeral containers are created and started by passing the flag -e /
--ephemeral. Whenever this flag is missing a copy of the container is created.
The flag -e / --ephemeral implies -s / --snapshot.

(a) start ephemeral container daemonized with random name:

lxc-copy -n aa -e

(b) start ephemeral container in foreground mode with random name:

lxc-copy -n aa -e -F

(c) start ephemeral container with specified name in daemonized mode:
    Analogous to lxc-start ephemeral containers start in daemonized
            mode per default:

lxc-copy -n aa -N bb -e

    One can however also explicitly pass -d / --daemon:

lxc-copy -n aa -N bb -e -d

    but both commands are equivalent.

(d) start non-ephemeral container in daemonized mode:

lxc-copy -n aa -D -e

(e) start ephemeral container in daemonized mode and keep the original
    hostname:

lxc-copy -n aa -K -e

(f) start ephemeral container in daemonized mode and keep the
    MAC-address of the original container:

lxc-copy -n aa -M -e

(g) start ephemeral container with custom mounts (additional mounts can
            be of type {bind,aufs,overlay}) in daemonized mode:

lxc-copy -n aa -e -m bind=/src:/dest:ro,aufs=/src:/dest,overlay=/src:/dest

(4) Other options:

lxc-copy --help

In order to create a random containername and random upper- and workdirs for
custom mounts we use mkdtemp() to not just create the names but also directly
create the corresponding directories. This will be safer and make the code
considerably shorter.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agodon't truncate environment sometimes in setproctitle
Tycho Andersen [Mon, 16 Nov 2015 22:12:36 +0000 (15:12 -0700)] 
don't truncate environment sometimes in setproctitle

Instead, let's just allocate new space for the proctitle to live and point
the kernel at that.

v2: take out testing hunk
v3: check return from realloc

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoseccomp: handle inverted arch 697/head
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>
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 agoFetch Debian archive GPG keyrings when they're not available 693/head
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>
9 years agoUse /usr/bin/env python3 instead of /usr/bin/python3 project-wide 692/head
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>
9 years agoutils: dialback setproctitle failure message
Tycho Andersen [Mon, 9 Nov 2015 20:33:32 +0000 (13:33 -0700)] 
utils: dialback setproctitle failure message

This isn't in any way fatal, so let's only warn about it with INFO, not
ERROR.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 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 agoc/r: use freezer to seize tasks
Tycho Andersen [Sat, 7 Nov 2015 00:26:43 +0000 (17:26 -0700)] 
c/r: use freezer to seize tasks

Instead of relying on the old ptrace loop, we should instead put all the
tasks in the container into the freezer. This will stop them all at the
same time, preventing fork bombs from causing criu to infinite loop (and is
also simply a lot faster).

Note that this uses --freeze-cgroup which isn't in criu 1.7, so it should
only go into master.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodefine PR_SET_MM_MAP & friends if necessary
Tycho Andersen [Fri, 6 Nov 2015 20:50:33 +0000 (13:50 -0700)] 
define PR_SET_MM_MAP & friends if necessary

PR_SET_MM_MAP only went in to the kernel at 3.18 (or 3.19), so we need to
define these for kernels before then. If there was an error, the code
simply logs the failure and continues on.

Also, we can drop the PR_SET_MM_otherstuff contstants since those were
dropped in 93525c00c76b2804c46cf3c275d610ebe71cb4be.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoc/r: don't require a veth link to c/r
Tycho Andersen [Fri, 6 Nov 2015 19:58:02 +0000 (12:58 -0700)] 
c/r: don't require a veth link to c/r

veths can be unconnected in the container's config, and we should handle
this case.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agouse PR_SET_MM_MAP instead of PR_SET_MM
Tycho Andersen [Fri, 6 Nov 2015 19:34:47 +0000 (12:34 -0700)] 
use PR_SET_MM_MAP instead of PR_SET_MM

PR_SET_MM_MAP can be called as non-root, which we are in the unprivileged
(or nested) case.

Also, let's not do the strcpy() for the new cmdline until after we're sure
the prctl succeeded. This means that even if it does fail, we won't
mutilate the command line like we did before, it just won't be as pretty.

v2: remember to chop off bits of the string that are too long

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoFix calculations in clone_update_unexp_hooks()
Christian Brauner [Tue, 3 Nov 2015 18:09:56 +0000 (19:09 +0100)] 
Fix calculations in clone_update_unexp_hooks()

Changes v3:
(1) Fix typo (q --> p).

(1) This commit fixes the calculations when updating paths in lxc.hooks.*
    entries. We now also update conf->unexpandend_alloced which hasn't been
done prior to this commit.

(2) Also we use the stricter check:

     if (p >= lend)
     continue;

    This should deal better with invalid config files.

(3) Insert some spaces between operators to increase readability.

(4) Use gotos to simplify function and increase readability.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoUpdate absolute paths for overlay and aufs mounts
Christian Brauner [Mon, 2 Nov 2015 22:20:36 +0000 (23:20 +0100)] 
Update absolute paths for overlay and aufs mounts

When using overlay and aufs mounts with lxc.mount.entry users have to specify
absolute paths for upperdir and workdir which will then get created
automatically by mount_entry_create_overlay_dirs() and
mount_entry_create_aufs_dirs() in conf.c. When we clone a container with
overlay or aufs lxc.mount.entry entries we need to update these absolute paths.
In order to do this we add the function update_ovl_paths() in
lxccontainer.c. The function updates the mounts in two locations:

        1) lxc_conf->mount_list

and

        2) lxc_conf->unexpanded_config (by calling clone_update_unexp_ovl_dir())

If we were to only update 2) we would end up with wrong upperdir and workdir
mounts as the absolute paths would still point to the container that serves as
the base for the clone. If we were to only update 1) we would end up with wrong
upperdir and workdir lxc.mount.entry entries in the clone's config as the
absolute paths in upperdir and workdir would still point to the container that
serves as the base for the clone. Updating both will get the job done.

NOTE: This function does not sanitize paths apart from removing trailing
slashes. (So when a user specifies //home//someone/// it will be cleaned to
//home//someone. This is the minimal path cleansing which is also done by
lxc_container_new().) But the mount_entry_create_overlay_dirs() and
mount_entry_create_aufs_dirs() functions both try to be extremely strict about
when to create upperdirs and workdirs. They will only accept sanitized paths,
i.e. they require /home/someone. I think this is a (safety) virtue and we
should consider sanitizing paths in general. In short: update_ovl_paths() does
update all absolute paths to the new container but
mount_entry_create_overlay_dirs() and mount_entry_create_aufs_dirs() will still
refuse to create upperdir and workdir when the updated path is unclean. This
happens easily when e.g. a user calls lxc-clone -o OLD -n NEW -P
//home//chb///.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoAdd clone_update_unexp_ovl_paths() function
Christian Brauner [Mon, 2 Nov 2015 22:20:35 +0000 (23:20 +0100)] 
Add clone_update_unexp_ovl_paths() function

This functions updates absolute paths for overlay upper- and workdirs so users
can simply clone and start new containers without worrying about absolute paths
in lxc.mount.entry overlay entries.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agohooks: put binary hooks into $libexecdir/lxc/hooks
Wolfgang Bumiller [Thu, 5 Nov 2015 14:02:11 +0000 (15:02 +0100)] 
hooks: put binary hooks into $libexecdir/lxc/hooks

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agosupport arguments in lxc.init_cmd
Serge Hallyn [Thu, 5 Nov 2015 22:18:52 +0000 (22:18 +0000)] 
support arguments in lxc.init_cmd

Otherwise something like
lxc.init_cmd = /sbin/init debug verbose
fails trying to execute a file called "/sbin/init debug verbose"

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoUnify the polite word style in Korean manpages
Sungbae Yoo [Mon, 2 Nov 2015 09:29:31 +0000 (18:29 +0900)] 
Unify the polite word style in Korean manpages

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add the description of lxc.hook.stop to Korean lxc.container.conf(5)
Sungbae Yoo [Mon, 2 Nov 2015 08:32:48 +0000 (17:32 +0900)] 
doc: Add the description of lxc.hook.stop to Korean lxc.container.conf(5)

Update for commit 0a2b5ab

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@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 agoMerge pull request #683 from Kubuxu/patch-1
Stéphane Graber [Fri, 30 Oct 2015 14:01:32 +0000 (10:01 -0400)] 
Merge pull request #683 from Kubuxu/patch-1

arch template: Fix systemd-sysctl service

9 years agoarch template: Fix systemd-sysctl service 683/head
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 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 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 agolxc-net: switch After target to network-online.target
Serge Hallyn [Tue, 27 Oct 2015 20:05:18 +0000 (20:05 +0000)] 
lxc-net: switch After target to network-online.target

Otherwise it may start too early and end up taking 10.0.3.1 even
though eth0 was eventually going to end up on 10.0.3.x.

https://bugs.launchpad.net/juju-core/+bug/1510619

Reported-by: Ryan Harper <ryan.harper@ubuntu.com>
Cc: Martin Pitt <martin.pitt@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@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 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 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 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 agodoc: Add the description of lxc.hook.stop to Japanese lxc.container.conf(5)
KATOH Yasufumi [Fri, 9 Oct 2015 06:14:22 +0000 (15:14 +0900)] 
doc: Add the description of lxc.hook.stop to Japanese lxc.container.conf(5)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add lxc.ephemeral in Korean lxc.container.conf(5)
Sungbae Yoo [Thu, 8 Oct 2015 03:06:25 +0000 (12:06 +0900)] 
doc: Add lxc.ephemeral in Korean lxc.container.conf(5)

Update for commit 4e6eb26

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agocoverity: free mounts on error path
Serge Hallyn [Sun, 18 Oct 2015 02:16:12 +0000 (21:16 -0500)] 
coverity: free mounts on error path

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoTell gcc about lxcmntent for the unmount hook
Stéphane Graber [Sun, 11 Oct 2015 22:44:38 +0000 (15:44 -0700)] 
Tell gcc about lxcmntent for the unmount hook

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoDon't include mntent when lxcmntent is used
Stéphane Graber [Sun, 11 Oct 2015 21:36:51 +0000 (14:36 -0700)] 
Don't include mntent when lxcmntent is used

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoDon't re-include config.h in lxcmntent.h
Stéphane Graber [Sun, 11 Oct 2015 20:29:36 +0000 (13:29 -0700)] 
Don't re-include config.h in lxcmntent.h

It causes trouble when importing from different paths and will always be
included ahead of time anyway.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoUpdate gitignore
Stéphane Graber [Sun, 11 Oct 2015 17:08:44 +0000 (13:08 -0400)] 
Update gitignore

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoAttempt to fix bionic builds of unmount-namespace
Stéphane Graber [Sun, 11 Oct 2015 17:07:52 +0000 (13:07 -0400)] 
Attempt to fix bionic builds of unmount-namespace

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add the note related mount in Korean lxc.container.conf(5)
Sungbae Yoo [Tue, 6 Oct 2015 09:29:01 +0000 (18:29 +0900)] 
doc: Add the note related mount in Korean lxc.container.conf(5)

Update for commit 592fd47

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add the common and '-s' option in Korean lxc-destroy(1)
Sungbae Yoo [Tue, 6 Oct 2015 09:26:49 +0000 (18:26 +0900)] 
doc: Add the common and '-s' option in Korean lxc-destroy(1)

Update for commit 3635c5e

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agodoc: Add lxc.ephemeral in Japanese lxc.container.conf(5)
KATOH Yasufumi [Tue, 6 Oct 2015 07:26:31 +0000 (16:26 +0900)] 
doc: Add lxc.ephemeral in Japanese lxc.container.conf(5)

Update for commit 4e6eb26

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoadded the unmount-namespace hook
Wolfgang Bumiller [Tue, 6 Oct 2015 08:01:07 +0000 (10:01 +0200)] 
added the unmount-namespace hook

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agodocument the stop hook
Wolfgang Bumiller [Tue, 6 Oct 2015 08:01:06 +0000 (10:01 +0200)] 
document the stop hook

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agopass namespace handles to the stop hook
Wolfgang Bumiller [Tue, 6 Oct 2015 08:01:05 +0000 (10:01 +0200)] 
pass namespace handles to the stop hook

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agorun stop hook between STOPPING and STOPPED states
Wolfgang Bumiller [Tue, 6 Oct 2015 08:01:04 +0000 (10:01 +0200)] 
run stop hook between STOPPING and STOPPED states

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoadded stop-hook entries
Wolfgang Bumiller [Tue, 6 Oct 2015 08:01:03 +0000 (10:01 +0200)] 
added stop-hook entries

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Serge E. Hallyn <serge.hallyn@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 agoMake lxc-start-ephemeral use lxc.ephemeral
Christian Brauner [Wed, 30 Sep 2015 12:32:24 +0000 (14:32 +0200)] 
Make lxc-start-ephemeral use lxc.ephemeral

While lxc-copy is under review let users benefit (reboot survival etc.) from the
new lxc.ephemeral option already in lxc-start-ephemeral. This way we can remove
the lxc.hook.post-stop script-

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoCleanup parts of lxc-destroy
Christian Brauner [Tue, 29 Sep 2015 17:48:23 +0000 (19:48 +0200)] 
Cleanup parts of lxc-destroy

A bit of pedantry usually doesn't hurt. The code should be easier to follow now
and avoids some repetitions.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoAdd lxc.ephemeral to lxc.container.conf manpage
Christian Brauner [Wed, 30 Sep 2015 12:56:55 +0000 (14:56 +0200)] 
Add lxc.ephemeral to lxc.container.conf manpage

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@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 agoMerge pull request #666 from Ponce/slackware-template
Stéphane Graber [Wed, 30 Sep 2015 17:58:01 +0000 (13:58 -0400)] 
Merge pull request #666 from Ponce/slackware-template

Add a slackware template.

9 years agoMerge pull request #667 from cjwatson/ephemeral-parse-passwd
Stéphane Graber [Wed, 30 Sep 2015 17:56:50 +0000 (13:56 -0400)] 
Merge pull request #667 from cjwatson/ephemeral-parse-passwd

lxc-start-ephemeral: Parse passwd directly

9 years agolxc-start-ephemeral: Parse passwd directly 667/head
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 agoAdd a slackware template. 666/head
Matteo Bernardini [Tue, 29 Sep 2015 15:35:25 +0000 (17:35 +0200)] 
Add a slackware template.

Requires pkgtools and slackpkg (from the slackware-current tree).

Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
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 agoRemove unnecessary call to free()
Christian Brauner [Mon, 28 Sep 2015 20:52:27 +0000 (22:52 +0200)] 
Remove unnecessary call to free()

Freeing memory when calloc() fails doesn't make sense

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@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 agoCheck return value of snprintf in mount_proc_if_needed()
Christian Brauner [Sun, 27 Sep 2015 08:32:28 +0000 (10:32 +0200)] 
Check return value of snprintf in mount_proc_if_needed()

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoCheck return value of snprintf
Christian Brauner [Sun, 27 Sep 2015 08:17:34 +0000 (10:17 +0200)] 
Check return value of snprintf

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: remove useless check
Serge Hallyn [Sat, 26 Sep 2015 21:03:53 +0000 (16:03 -0500)] 
coverity: remove useless check

handler->conf can't be null bc we checked handler->conf->epheemral
before calling lxc_destroy_container_on_signal()

Signed-off-by: Serge Hallyn <serge.hallyn@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 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 agoubuntu.common.conf: mount /dev/mqueue
Serge Hallyn [Wed, 23 Sep 2015 19:49:06 +0000 (19:49 +0000)] 
ubuntu.common.conf: mount /dev/mqueue

systemd wants it.  It doesn't seem to be a big deal, but it's
one fewer error msg.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
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 agoMake ephemeral containers survive reboots
Christian Brauner [Mon, 21 Sep 2015 16:01:41 +0000 (18:01 +0200)] 
Make ephemeral containers survive reboots

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
9 years agoRemove ephemeral containers from lxc_snapshots
Christian Brauner [Tue, 15 Sep 2015 19:24:05 +0000 (21:24 +0200)] 
Remove ephemeral containers from lxc_snapshots

On shutdown ephemeral containers will be destroyed. We use mod_all_rdeps() from
lxccontainer.c to update the lxc_snapshots file of the original container. We
also include lxclock.h to lock the container when mod_all_rdeps() is called to
avoid races.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoMake mod_all_rdeps() public It will now also be called from start.c
Christian Brauner [Tue, 15 Sep 2015 19:24:04 +0000 (21:24 +0200)] 
Make mod_all_rdeps() public It will now also be called from start.c

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@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 agogitignore: add Korean man page output
Tycho Andersen [Fri, 11 Sep 2015 18:45:34 +0000 (12:45 -0600)] 
gitignore: add Korean man page output

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agogitignore: add strange lxc@.service file
Tycho Andersen [Fri, 11 Sep 2015 18:45:35 +0000 (12:45 -0600)] 
gitignore: add strange lxc@.service file

I have no idea what this file is, but the build system seems to be
generating it, so let's ignore it.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoEnsure that mmap()ed memory is \0-terminated (v3)
Christian Brauner [Fri, 11 Sep 2015 06:07:37 +0000 (08:07 +0200)] 
Ensure that mmap()ed memory is \0-terminated (v3)

Use pwrite() to write terminating \0-byte

This allows us to use standard string handling functions and we can avoid using
the GNU-extension memmem(). This simplifies removing the container from the
lxc_snapshots file. Wrap strstr() in a while loop to remove duplicate entries.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoFixing MTU calculation in instantiate_veth()]
Stephane Nguyen [Wed, 9 Sep 2015 06:22:52 +0000 (08:22 +0200)] 
Fixing MTU calculation in instantiate_veth()]

Signed-off-by: Stephane Nguyen <stephminh@yahoo.es>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
9 years agoEnable lxc_fini() to destroy container on shutdown
Christian Brauner [Tue, 8 Sep 2015 20:37:16 +0000 (22:37 +0200)] 
Enable lxc_fini() to destroy container on shutdown

When lxc.ephemeral is set to 1 in the containers config it will be destroyed on
shutdown.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>