Commit Graph

4714 Commits

Author SHA1 Message Date
Aleksandr Mezin
c44de748af start: open /dev/null from "host" /dev
Sometimes, a container doesn't have /dev/null.
For example, I have this problem with Android container.

This fixes #910 (github) for me.

Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
2016-03-24 23:22:32 +06:00
Aleksandr Mezin
f8dd027559 utils: split null_stdfds() to open_devnull() and set_stdfds()
Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
2016-03-24 23:20:42 +06:00
Bogdan Purcareata
07e4c41f29 lxc-busybox: Remove warning for dynamically linked Busybox
The warning has been present since commit 32b37181ea (with no purpose stated).
Support for dynamically linked Busybox has been added since commit bf6cc73696.
Haven't encountered any issues with dynamically linked Busybox in my last
2 years' testing.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2016-03-24 12:46:32 -04:00
Stéphane Graber
cce8b5cf1d Merge pull request #916 from ojkastl/20160324_Fix_path_to_lxc-net_config
lxc.spec.in: fixed hardcoded path to lxc-net config file
2016-03-24 12:38:51 -04:00
Aleksandr Mezin
d1ccb562a9 start: use LXC_SYNC_ERROR to report errors.
This gives more meaningful error message than "invalid sequence".

Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
2016-03-24 17:55:03 +06:00
Aleksandr Mezin
ea720ff1d0 sync: add LXC_SYNC_ERROR to report errors from another process.
Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
2016-03-24 17:54:26 +06:00
Johannes Kastl
cd27b6c810 lxc.spec.in: fixed hardcoded path to lxc-net config file
Signed-off-by: Johannes Kastl <git@ojkastl.de>
2016-03-24 09:26:28 +01:00
Christian Brauner
28711463f8 Merge pull request #914 from brauner/2016-03-23/Purcarea_Bogdan
lxc-busybox: Touch /etc/fstab in the container rootfs
2016-03-24 08:13:12 +01:00
Bogdan Purcareata
6ab1ca0375 lxc-busybox: Touch /etc/fstab in the container rootfs
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2016-03-24 07:09:15 +01:00
Serge Hallyn
173e82050f Merge pull request #911 from brauner/2016-03-23/Purcarea_Bogdan
open_without_symlink: Don't SYSERROR on something else than ELOOP
2016-03-23 09:53:35 -07:00
Christian Brauner
88e078ba86 open_without_symlink: Don't SYSERROR on something else than ELOOP
The open_without_symlink routine has been specifically created to prevent
mounts with synlinks as source or destination. Keep SYSERROR'ing in that
particular scenario, but leave error handling to calling functions for the
other ones - e.g. optional bind mount when the source dir doesn't exist
throws a nasty error.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2016-03-23 16:37:09 +01:00
Stéphane Graber
684753c2ba change version to 2.0.0.rc13 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-03-22 17:22:23 -04:00
Christian Brauner
1becda46c0 Merge pull request #908 from tych0/fix-907
Fix 907
2016-03-22 16:47:00 +01:00
Tycho Andersen
b7088add70 c/r: rename restore & friends to __criu_restore
Hopefully this will avoid name collisions with any user binaries, since
criu is just an implementation detail.

Closes #907

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-03-22 09:26:55 -06:00
Tycho Andersen
fa25c39a44 lxc-checkpoint: make things static when they can be
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-03-22 09:22:39 -06:00
Serge Hallyn
f036e5ce58 Merge pull request #906 from tych0/fix-console-none-migration
Fix console none migration
2016-03-21 16:39:05 -07:00
Tycho Andersen
97e4f1a91f c/r: don't fail if there is no console_fd on restore
If we set lxc.console=none, this fd won't exist, so let's not fail if it
doesn't. We already partially handled this case correctly, so let's
actually handle it correctly :)

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-03-21 16:56:03 -06:00
Tycho Andersen
36d2096cf4 c/r: don't pass --ext-mount-map flag when console=none
We don't pass anything on the restore side since we didn't save anything,
but the restore side will expect something if we pass this. Instead, let's
not pass anything.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-03-21 16:50:39 -06:00
Stéphane Graber
ecd852f35e change version to 2.0.0.rc12 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-03-21 16:44:45 -04:00
Stéphane Graber
56d6e75bc0 Merge pull request #902 from tych0/better-criu-logging
Better criu logging
2016-03-18 16:12:45 -04:00
Tycho Andersen
3d9a5c85fd c/r: print criu's stdout when it fails
In particular, when CRIU fails before it has its log completely initialized
(e.g. if the log directory doesn't exist, or if the argument parser fails),
it prints this to stdout. Let's log that.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-03-18 13:13:17 -06:00
Tycho Andersen
cf4b07a5af c/r: log the exact command we exec
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-03-18 10:19:36 -06:00
Stéphane Graber
72e7e16809 change version to 2.0.0.rc11 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-03-17 23:11:50 -04:00
Christian Brauner
c37948886b Merge pull request #901 from stgraber/master
download: Bump to compat level 3
2016-03-17 23:01:45 +01:00
Stéphane Graber
9fd38724d9 download: Bump to compat level 3
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-03-17 17:43:03 -04:00
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