Commit Graph

4339 Commits

Author SHA1 Message Date
Stéphane Graber
c9013d0379 Merge pull request #900 from tych0/dont-always-create-console
autodev: don't always create /dev/console
2016-03-17 16:02:47 -04:00
Tycho Andersen
0728ebf499 autodev: don't always create /dev/console
In particular, only create /dev/console when it is set to "none".
Otherwise, we will bind mount a pts device later, so let's just leave it.

Also, when bind mounting the pts device, let's create /dev/console if it
doesn't exist, since it may not already exist due to the above :)

v2: s/ot/to
v3: add O_EXCL so we actually get EEXIST, use the right condition for
    mount_console (we want to compare against console.path, not
    console.name, and console.path can be null)

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-03-17 13:39:15 -06:00
Stéphane Graber
16ec15b27b Merge pull request #899 from hallyn/2016-03-16/cgroupauto.2
cgfsng: include sys/mount.h
2016-03-17 02:53:44 -04:00
Serge Hallyn
5b6f9369c7 cgfsng: two fixes for cgroup-full
We need to pass nosuid+nexec+nodev to remount to stop the kernel
from denying it.

When remounting the container's path read-write, use the right dest
path.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-16 23:12:57 -07:00
Serge Hallyn
3e32591c20 include bdev.h
for the define of RELATIME for android

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-16 21:27:24 -07:00
Serge Hallyn
ef4413faac use hierarchy base path not just controller cgroup
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-16 21:22:00 -07:00
Serge Hallyn
f0368a9fad cgfsng: include sys/mount.h
to hopefully define RELATIME for android

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-16 20:55:11 -07:00
Stéphane Graber
3860edcb71 Merge pull request #898 from hallyn/2016-03-16/cgroupauto
2016 03 16/cgroupauto
2016-03-16 22:58:33 -04:00
Serge Hallyn
a8de4c49f1 no variable decl in for loop
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-16 19:05:06 -07:00
Serge Hallyn
9ec45e7faa cgroups: try to load cgmanager first
If cgmanager is running, use it.  This allows the admin to simply
stop cgmanager if they don't want to use it.  The other way there
is no way to choose to use cgmanager.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-16 16:33:03 -07:00
Serge Hallyn
8aa1044fd8 implement lxc.mount.auto = cgroup for cgfsng
Also add testcase for each of the cgroup{,-full}:{rw,ro,mixed} cases.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-16 15:55:19 -07:00
Christian Brauner
e97069ad38 Merge pull request #897 from hallyn/2016-03-16/aa
Prevent access to pci devices
2016-03-16 23:35:34 +01:00
Serge Hallyn
4845c17aff Prevent access to pci devices
Prevent privileged containers from messing with the host's pci devices
directly.  Refuse access under /proc/bus, and drop cap_sys_rawio.  Some
containers may need to re-enable cap_sys_rawio (i.e. if they run an
X server).

It may be desirable to break some of this stuff into files which can be
separately included (or not included), but this patch isn't the right
place for that.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-16 15:18:51 -07:00
Stéphane Graber
b3e4df8a83 Merge pull request #896 from hallyn/2016-03-15/nest
2016 03 15/nest
2016-03-15 18:21:12 -04:00
Serge Hallyn
e6bff191fb nesting: remove the nesting hint from configuration templates
we're having it inserted in every config by the lxcapi_create
itself.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-15 14:47:44 -07:00
Serge Hallyn
49a2ed808c nesting: document how to enable nesting in container configurations
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-15 14:43:44 -07:00
Stéphane Graber
01283774e8 Merge pull request #895 from tych0/fix-android-build
build: fix build on android (and ppc)
2016-03-15 14:21:01 -04:00
Tycho Andersen
f03280a760 build: fix build on android (and ppc)
The problem here is that dev_t on most platforms is `long unsigned`, but on
android (and ppc?) it's `long long unsigned`. Let's just upcast to `long
long unsigned` and use that format string to keep the compilers happy.

Safety first!

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-03-15 12:01:36 -06:00
Stéphane Graber
75d0c7b3f5 Merge pull request #893 from tych0/dont-require-dev-console-none
Dont require dev console none
2016-03-15 13:32:49 -04:00
Tycho Andersen
4b54788e85 c/r: drop lxc.console=none config requirement
There are a few things going on in this patch.

1. /dev/console is an external mount since it is bind mounted from the
   host. However, we don't want to use criu's --ext-mount-map auto handling
   here, because that will bind mount exactly the same path from the host
   on restore, but if the pts device is different on the target host, we'll
   bind mount the wrong one, which is obviously wrong.

2. We need to tell CRIU how to restore the TTY. Since we declare the tty as
   --external, we need to provide it via --inherit-fd (even though we've
   already fixed up the environment).

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-03-15 09:31:15 -06:00
Tycho Andersen
73d467522b criu: hide more stuff in criu.c
Various other functions/structures are now only used in criu.c, so let's
hide stuff there so as not to pollute headers.

This commit also bumps the required CRIU versions to 2.0. While we don't
*require* any features that aren't in 1.8 patchlevel 21 or above, 2.0 is a
vast improvement, and so we should use that instead.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-03-11 19:15:32 -07:00
Stéphane Graber
f86f41616a change version to 2.0.0.rc10 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-03-11 01:16:54 -05:00
Stéphane Graber
75b384160b Merge pull request #892 from hallyn/2016-03-10/tasks
cgfsng: chmod the tasks and procns files
2016-03-11 00:23:49 -05:00
Serge Hallyn
e2db2a89a8 cgfsng: fix inverse null check
remove the hierarchy if the fullcgpath is NOT null.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-10 20:50:59 -08:00
Serge Hallyn
ab8f5424ce cgfsng: chmod the tasks and procns files
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
---
 Changelog - stgraber points out s/chgrp/chmod and wrong perms
2016-03-10 20:50:38 -08:00
Stéphane Graber
87297f60fc Merge pull request #890 from hallyn/2016-03-10/cgfix
cgfsng: get_cgroup_path: return the cgroup path not full mounted path
2016-03-10 17:50:56 -05:00
Serge Hallyn
371f834d95 cgfsng: get_cgroup_path: return the cgroup path not full mounted path
Add a temporary workaround for talking to containers started with the
buggy monitor.  We can remove it sometime after 2.0 release.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-10 13:13:27 -08:00
Serge Hallyn
1a4faf5165 Merge pull request #889 from tych0/cgfsng-fixes
Cgfsng fixes
2016-03-10 11:24:02 -08:00
Tycho Andersen
7103fe6f08 cgroup: cgroup_escape takes no arguments
cgroup_escape() is a slight abuse of the cgroup code: what we really want
here is to escape the *current* process, whether it happens to be the LXC
monitor or not, into the / cgroups.

In the case of dump, we can't do an lxc_init(), because:

lxc 20160310103501.547 ERROR    lxc_commands - commands.c:lxc_cmd_init:993 - ##
lxc 20160310103501.547 ERROR    lxc_commands - commands.c:lxc_cmd_init:994 - # The container appears to be already running!
lxc 20160310103501.547 ERROR    lxc_commands - commands.c:lxc_cmd_init:995 - ##

We don't want to make this a command to send to the handler, because again,
cgroup_escape() is intended to escape the *current* task to the root
cgroups.

So, let's just have cgroup_escape() build its own handler when required.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-03-10 12:01:34 -07:00
Tycho Andersen
9451eeffb0 criu: make exec_criu static
This is no longer needed outside of criu.c with the ->migrate API call, so
let's mark it that way.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-03-10 12:01:34 -07:00
Stéphane Graber
ef37205707 Merge pull request #885 from brauner/bugfix_branch
lxc-attach: update and improve tests
2016-03-09 12:20:48 -05:00
Christian Brauner
172d397e6f lxc-attach: update and improve tests
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-03-09 15:56:20 +01:00
Stéphane Graber
7e163e66e4 change version to 2.0.0.rc9 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-03-09 03:02:58 -05:00
Christian Brauner
6b6c6b2bdd Merge pull request #884 from hallyn/2016-03-08/batch
2016 03 08/batch
2016-03-09 08:53:03 +01:00
Serge Hallyn
d8da679e2a cgfsng: make sure a cgroup does not already exist
Our mkdir_p ignore eexist, and of course we want that for
upper path components, but the final directory itself must
not already exist.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-08 23:34:19 -08:00
Serge Hallyn
b4ffcca8e8 cgfsng: fix real bug and fake libc realloc bug
read_file was using the wrong value for the string length.  Also,
realloc on i386 is wonky with small sizes - so use a batch size
to avoid small reallocs.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-08 23:18:11 -08:00
Stéphane Graber
5d5c5694bd change version to 2.0.0.rc8 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-03-08 17:39:34 -05:00
Stéphane Graber
43c01da697 Merge pull request #883 from hallyn/2016-03-08/cgrouptests
tests: set clone_children if need be
2016-03-08 17:10:52 -05:00
Serge Hallyn
177f793ae0 tests: set clone_children if need be
Lxc only sets it on /lxc, not on /.

It's conceivable that we should really re-set this to the original
value, to prevent making later tests not fail when they should.  I
didn't do that.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-08 13:44:38 -08:00
Christian Brauner
e5cf81b811 Merge pull request #882 from hallyn/2016-03-08/cgfsng.2
cgfsng: set cpuset clone_children if needed
2016-03-08 22:19:45 +01:00
Serge Hallyn
e3a3fecfe7 cgfsng: set cpuset clone_children if needed
Sigh.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-08 12:49:52 -08:00
Stéphane Graber
6374c9ec63 Merge pull request #881 from hallyn/2016-03-08/cgfsng.1
cgfsng: enter/escape error msgs: differentiate and add errno
2016-03-08 12:04:41 -05:00
Serge Hallyn
d3b00a8f48 cgfsng: enter/escape error msgs: differentiate and add errno
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-08 09:02:52 -08:00
Serge Hallyn
4ca12a5925 Merge pull request #880 from stgraber/master
Remove trailing newlines in log
2016-03-08 08:08:53 -08:00
Stéphane Graber
1c9da8dac4 Remove trailing newlines in log
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-03-08 09:51:01 -05:00
Stéphane Graber
d551c8cb3f Merge pull request #879 from hallyn/2016-03-07/debug.aa
prevent containers from reading /sys/kernel/debug
2016-03-07 22:13:24 -05:00
Serge Hallyn
537188a8ee prevent containers from reading /sys/kernel/debug
Unprivileged containers cannot read it anyway, but also prevent root
owned containers from doing so.  Sadly upstart's mountall won't run
if we try to prevent it from being mounted at all.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-03-07 19:10:58 -08:00
Stéphane Graber
215486610e
change version to 2.0.0.rc7 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-03-07 18:47:50 -05:00
Stéphane Graber
892560848d
Fix dist tarball to include lxc-devsetup
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-03-07 18:31:27 -05:00
Stéphane Graber
5e8b3276d0
change version to 2.0.0.rc6 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-03-07 18:20:40 -05:00