Commit Graph

6330 Commits

Author SHA1 Message Date
Christian Brauner
48b1dc4cdc
cmd: move lxc-checkconfig
Closes #2073.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-06 21:03:32 +01:00
Christian Brauner
2a5ee335a6
cmd: move init.lxc{.static}
Closes #2073.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-06 21:03:32 +01:00
Christian Brauner
844d9eac45
cmd: move lxc-lxc_usernsexec
Closes #2073.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-06 21:03:32 +01:00
Christian Brauner
744b1eec11
tools: move lxc-cgroup to API symbols only
Closes #2073.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-06 21:03:32 +01:00
Christian Brauner
a9ff89baa0
tools: move lxc-autostart to API symbols only
Closes #2073.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-06 21:03:32 +01:00
Christian Brauner
a6993015de
tools: lxc-autostart: non-functional changes
Closes #2073.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-06 21:03:31 +01:00
Christian Brauner
9267beba7b
tools: move lxc-attach to API symbols only
Closes #2073.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-06 21:03:29 +01:00
Serge Hallyn
3fb8253d91
Merge pull request #2117 from brauner/2018-01-26/cgroup_v2_support
cgroups: add unified hierarchy support
2018-02-06 13:19:10 -06:00
Serge Hallyn
d8eb058d08
Merge pull request #2044 from brauner/2017-12-16/lxc_ls_add_unprivileged_field
tools: add UNPRIVILEGED field in fancy output mode
2018-02-06 13:08:49 -06:00
Serge Hallyn
af3f9cc96e
Merge pull request #2130 from tych0/sigterm-handling
Sigterm handling
2018-02-05 09:00:27 -06:00
Christian Brauner
05f2fed731
Merge pull request #2129 from tych0/sigterm-sigkill
lxc-init: use SIGKILL after alarm timeout
2018-02-05 15:47:07 +01:00
Tycho Andersen
186dfb166a lxc.init: ignore SIGHUP
see comment for details.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-02-05 14:19:25 +00:00
Tycho Andersen
d4b5d7a8b4 monitor: send SIGTERM to the container when SIGHUP is received
For the ->execute() case, we want to make sure the application dies when
SIGHUP is received. The next patch will ignore SIGHUP in the lxc monitor,
because tasks inside the container send SIGHUP to init to have it reload
its config sometimes, and we don't want to do that with init.lxc, since it
might actually kill the container if it forwards SIGHUP to the child and
the child can't handle it.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-02-05 14:17:48 +00:00
Tycho Andersen
60e324aa5b lxc-init: use SIGKILL after alarm timeout
d76e3e1 inadvertently switched the alarm timeout from sigterm to sigkill.
We really want sigkill here, so let's bring it back.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-02-05 14:13:18 +00:00
Christian Brauner
e6bd446c81
Merge pull request #2126 from flx42/nvidia-visible-devices-change-null-semantic
hooks: change the semantic of NVIDIA_VISIBLE_DEVICES=""
2018-02-02 16:11:50 +01:00
Felix Abecassis
b87243830e hooks: change the semantic of NVIDIA_VISIBLE_DEVICES=""
With LXC, you can override the value of an environment variable to
null, but you can't unset an existing variable.

The NVIDIA hook was previously activated when NVIDIA_VISIBLE_DEVICES
was set to null. As a result, it was not possible to disable the hook
by overriding the environment variable in the configuration.

The hook can now be disabled by setting NVIDIA_VISIBLE_DEVICES to
null or to the new special value "void".

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2018-02-02 06:19:13 -08:00
Christian Brauner
b046bbab2e
Merge pull request #2120 from stgraber/master
debian: We must use iproute on wheezy
2018-02-01 15:55:25 +01:00
Stéphane Graber
24d871358d
debian: We must use iproute on wheezy
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2018-02-01 15:44:43 +01:00
Stéphane Graber
0b7ab4c7dc
Merge pull request #2119 from brauner/2018-02-01/fix_android
lsm: do not #ifdefine
2018-02-01 15:26:22 +01:00
Christian Brauner
1fb5e888a6
lsm: do not #ifdefine
Since we stopped linking against AppArmor we can now remove the conditional
compilation.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-01 13:14:36 +01:00
Serge Hallyn
0bf1c3082f
Merge pull request #2114 from brauner/2018-01-27/make_name_arg_optional
tools: make "-n" optional
2018-01-31 22:11:48 -06:00
Christian Brauner
a3926f6a95
cgroups: more consistent naming
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-31 17:09:13 +01:00
Christian Brauner
6b38e644cb
cgroups: handle limits on the unified hierarchy
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-31 16:45:04 +01:00
Christian Brauner
54860ed027
confile: add lxc.cgroup2.[controller].[property]
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-31 16:44:30 +01:00
Christian Brauner
8777796839
cgroups: cgfsng_set: handle unified hierarchy
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-31 16:42:19 +01:00
Christian Brauner
0069cc619e
cgroups: cgfsng_get: handle unified hierarchy
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-31 16:41:53 +01:00
Christian Brauner
c2aed66d0f
cgroups: cgfsng_attach: handle unified hierarchy
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-31 16:39:57 +01:00
Christian Brauner
0c3deb94f4
cgroups: cgfsng_create: handle unified hierarchy
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-31 16:35:31 +01:00
Christian Brauner
d6337a5f9d
cgroups: get controllers on the unified hierarchy
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-31 16:30:53 +01:00
Stéphane Graber
2ddc66536b
Merge pull request #2116 from brauner/2018-01-29/legacy_network_fixes
confile_legacy: fix legacy network parser
2018-01-29 20:06:50 -05:00
Christian Brauner
70a82405f4
confile_legacy: fix legacy network parser
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-30 01:00:21 +01:00
Serge Hallyn
26f0e9151a
Merge pull request #2102 from brauner/2018-01-22/lsm_simplifications
lsm: simplifcations
2018-01-29 17:08:38 -06:00
Christian Brauner
817a0e46b6
tools: make "-n" optional
This lets users use the tools with "lxc-* -n <container-name>" or
"lxc-* <container-name>".

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-27 16:09:46 +01:00
Christian Brauner
cf73b78c0c
Merge pull request #2113 from marcosps/seccomp_return
seccomp.c: Use return instead of attribution and return
2018-01-27 15:50:13 +01:00
Marcos Paulo de Souza
29cb26174d seccomp.c: Use return instead of attribution and return
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
2018-01-27 11:13:20 -02:00
Christian Brauner
8f57ca64fb
Merge pull request #2112 from stgraber/master
debian: Use iproute2 instead of iproute
2018-01-27 12:31:50 +01:00
Stéphane Graber
8926686153
debian: Use iproute2 instead of iproute
The package has pretty much always been iproute2 with iproute being an
alias for it, the alias is now gone so we need to use iproute2.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2018-01-27 00:33:12 -05:00
Christian Brauner
0cea297717
Merge pull request #2111 from tych0/unpriv-fixups
Unpriv fixups
2018-01-26 23:39:29 +01:00
Tycho Andersen
5384e99dee rename am_unpriv to am_host_unpriv
Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-01-26 22:11:50 +00:00
Tycho Andersen
4692c01af2 better unprivileged detection
In particular, if we are already in a user namespace we are unprivileged,
and doing things like moving the physical nics back to the host netns won't
work. Let's do the same thing LXD does if euid == 0: inspect
/proc/self/uid_map and see what that says.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-01-26 22:11:50 +00:00
Tycho Andersen
9650c735c7 better check for lock dir
Consider the case where we're running in a user namespace but in the host's
mount ns with the host's filesystem (something like
lxc-usernsexec ... lxc-execute ...), in this case, we'll be euid 0, but we
can't actually write to /run. Let's improve this locking check to make sure
we can actually write to /run before we decide to actually use it as our
locking dir.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-01-26 21:28:28 +00:00
Christian Brauner
3fdb1cf431
Merge pull request #2109 from duguhaotian/new
[cgfsng] show wrong errno
2018-01-26 14:54:35 +01:00
duguhaotian
d1953b26c8 [cgfsng] show wrong errno
lxc_cgroup_set_data: h = get_hierarchy(controller);
if h is NULL, now errno is old, it donot set new one.
And then,
cgfsng_setup_limits:

    if (lxc_cgroup_set_data(cg->subsystem, cg->value, d)) {
		if (do_devices && (errno == EACCES ||
			errno == EPERM)) {
			WARN("Error setting %s to %s for %s",
				cg->subsystem, cg->value,
				d->name);
			continue;
		}
		SYSERROR("Error setting %s to %s for
			 %s",
			 cg->subsystem, cg->value,
			 d->name);
		goto out;
	}

SYSERROR will show old errno, make me confused.

Signed-off-by: duguhaotian <duguhaotian@gmail.com>
2018-01-26 21:07:58 +08:00
Stéphane Graber
f1289f48d6
Merge pull request #2099 from brauner/2018-01-20/attach_init_pty
bugfixes
2018-01-24 22:24:46 +02:00
Christian Brauner
b28e282611
Merge pull request #2103 from marcosps/forward_not_used
network.c: Remove ip_forward_set and callers
2018-01-23 11:31:53 +01:00
Marcos Paulo de Souza
c0a6d713b2 network.c: Remove ip_forward_set and callers
The last user of ip_forward_set, lxc_ip_forward_on and
lxc_ip_forward_off was in 2009:

commit 92d385229b
Author: Daniel Lezcano <dlezcano@fr.ibm.com>
Date:   Thu Oct 22 15:33:40 2009 +0200

    remove test directory

These functions are not called anymore.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
2018-01-22 22:04:03 -02:00
Christian Brauner
05f0f93a93
autotools: do not link against libapparmor
Since we write the label directly without going through the AppArmor API it
doesn't make sense to link against it.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-22 12:14:21 +01:00
Christian Brauner
5288a74faa
apparmor: do not call aa_change_profile()
We can simply write the label ourselves. There's no magic happening.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-22 12:14:14 +01:00
Christian Brauner
d3ba7c9872
lsm: add lsm_process_label_set_at()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-22 11:54:21 +01:00
Christian Brauner
47ce2cb727
lsm: add lsm_process_label_fd_get()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-01-22 10:54:38 +01:00