Commit Graph

6355 Commits

Author SHA1 Message Date
Christian Brauner
287df277ff
coverity: #1425971
Dereference after null check

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-09 10:37:53 +01:00
Christian Brauner
f38cf5b8f4
coverity: #1426083
Dereference after null check

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-09 10:37:53 +01:00
Christian Brauner
cb8ff4d033
lxccontainer: satisfy coverity
The container name can't be NULL so don't give coverity the impression that it
could be.

Silences coverity #1426123.
Silences coverity #1426124.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-09 10:37:53 +01:00
Christian Brauner
341ed84c47
start: use goto instead of simple return
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-09 10:37:52 +01:00
Christian Brauner
5b7f756a67
coverity: #1426126
Unchecked return value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-09 10:37:49 +01:00
Christian Brauner
fa456191d0
coverity: #1426734
Argument cannot be negative

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-09 00:25:53 +01:00
Christian Brauner
bd01b7d552
coverity: #1429139
Resource leak

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-09 00:25:50 +01:00
Christian Brauner
e3fe3512c3
Merge pull request #2142 from hallyn/2018-02-08/priv
2018 02 08/priv
2018-02-08 23:40:50 +01:00
Serge Hallyn
e0010464c7 Restore most cases of am_guest_unpriv
The only cases where we really need to be privileged with respect
to the host is when we are trying to mknod, and in some cases
to do with a physical network device.  This patch leaves the
detection of the network device cases as a TODO.

This should fix the currently broken case of starting a privileged
container with at least one veth nic, nested inside an unprivileged
container.

Cc: Tycho Andersen <tycho@tycho.ws>
Signed-off-by: Serge Hallyn <shallyn@cisco.com>
2018-02-08 13:06:52 -06:00
Serge Hallyn
477aa378e9 define am_guest_unpriv
Sometimes we want to know whether we are privileged wrt our
namespaces, and sometimes we want to know whether we are priv
wrt init_user_ns.

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
2018-02-08 12:06:39 -06:00
Stéphane Graber
5596585d3b
Merge pull request #2125 from brauner/2018-02-02/add_namespace_configs
confile: add lxc.namespace.share.[namespace], lxc.namespace.keep, lxc.namespace.clone
2018-02-08 10:26:57 -05:00
Stéphane Graber
dfb7073f20
Merge pull request #2137 from brauner/2018-02-07/fix_unprivileged_flag
tools/lxc-ls: fix logic for unpriv containers
2018-02-08 10:26:09 -05:00
Stéphane Graber
d99e66cd14
Merge pull request #2140 from brauner/2018-02-08/cgfsng_fix_ro_remount
cgfsng: add required remount flags
2018-02-08 10:25:50 -05:00
Christian Brauner
5285689c58
cgfsng: add required remount flags
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9566d6742852c527bf5af38af5cbb878dad75705

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-08 11:37:16 +01:00
Christian Brauner
ca20a3b350
Merge branch 'marcosps-selinux_simplification' into lxc/master 2018-02-08 10:50:10 +01:00
Marcos Paulo de Souza
08fccae2bb
lsm: fix missing @ in function documentation
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
2018-02-08 10:49:51 +01:00
Marcos Paulo de Souza
1be8cb0450
selinux: simplify check for default label
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-08 10:49:48 +01:00
Christian Brauner
5c80e9fcb4
Merge branch 'marcosps-issue_870' into lxc/master 2018-02-08 10:34:54 +01:00
Marcos Paulo de Souza
9ea09fb48b
cgroups: add check for lxc.cgroup.use
Closes #870.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
2018-02-08 10:34:28 +01:00
Christian Brauner
f71634fcc9
tools/lxc-ls: fix logic for unpriv containers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-07 21:06:01 +01:00
Christian Brauner
ff5976cd54
templates: CentOS fixes
Issues fixed:
- lxc-centos died about a missing /run directory
- lxc-centos complained about some config files it couldn't modify
- the new container got stuck at startup time for a minute
  (literally), waiting for systemd-remount-fs startup script

Of course it still works for RHEL 6, CentOS 6 and 7 as well. I did not
verify earlier CentOS or RHEL releases.

Signed-off-by: Harald Dunkel <harald.dunkel@aixigo.de>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-07 11:39:19 +01:00
Christian Brauner
08fbe494cc
Merge branch 'lifeng68-remount_cgroup' into lxc/master 2018-02-07 11:30:40 +01:00
Christian Brauner
886cac862b
cgfsng: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-07 11:27:57 +01:00
LiFeng
f8c40ffa39
cgfsng: do MS_REMOUNT
Perform MS_REMOUNT on mounts with MS_RDONLY.

Signed-off-by: LiFeng <lifeng68@huawei.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-07 11:21:57 +01:00
Christian Brauner
c112f06d29
Merge branch 'lifeng68-use_env_vars_in_container' into lxc/master 2018-02-07 11:18:42 +01:00
Christian Brauner
3d55242aa5
attach: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-07 11:15:37 +01:00
l00415420
7385273fc4
attach: set the container's environment variables
Set the same environment variables that were used when starting the container
when attaching to the container.

Signed-off-by: LiFeng <lifeng68@huawei.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-07 11:04:42 +01:00
Christian Brauner
46186acdb0
doc: add lxc.namespace.clone + lxc.namespace.keep
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-06 20:52:18 +01:00
Christian Brauner
8bc8c7159f
start: resolve clone flags
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-06 20:48:50 +01:00
Christian Brauner
abeb5bba94
confile: add lxc.namespace.keep
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-06 20:48:50 +01:00
Christian Brauner
1d8d367638
confile: add lxc.namespace.clone
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-06 20:48:50 +01:00
Christian Brauner
b074bbf179
confile: lxc.namespace.* -> lxc.namespace.share.*
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-06 20:48:47 +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