Commit Graph

5070 Commits

Author SHA1 Message Date
Christian Brauner
78625a5e3e
conf{,ile}: allow to clear all config items
Closes #1561.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-15 15:24:17 +02:00
0x0916
4836330b1a seccomp: print action name in log
This patch add function `get_action_name`, so we can print action name
in the log file. for example:

```
lxc-start ubuntu 20170515095416.561 INFO     lxc_seccomp - seccomp.c:parse_config_v2:613 - Adding compat rule for reject_force_umount action 0(kill).
lxc-start ubuntu 20170515095416.562 INFO     lxc_seccomp - seccomp.c:parse_config_v2:613 - Adding compat rule for kexec_load action 327681(errno).
```

Signed-off-by: 0x0916 <w@laoqinren.net>
2017-05-15 20:45:55 +08:00
0x0916
998cd2f417 seccomp: update comment for function parse_config
Signed-off-by: 0x0916 <w@laoqinren.net>
2017-05-15 18:44:00 +08:00
0x0916
65afdf08b5 seccomp: s/n-new-privs/no-new-privs/g
Signed-off-by: 0x0916 <w@laoqinren.net>
2017-05-15 18:44:00 +08:00
Christian Brauner
179029df91 Merge pull request #1558 from 0x0916/lxc-top
add more detail for blkio
2017-05-15 11:06:56 +02:00
Christian Brauner
d698ad1000 Merge pull request #1562 from 0x0916/delete-unneccessory-include
monitor: delete unnecessary include file
2017-05-15 11:06:24 +02:00
0x0916
10174cd257 monitor: delete unneccessory include file
we want to export `monitor.h`, `#include "conf.h"` will cause error
and it is unneccessory so just delete it.

Signed-off-by: 0x0916 <w@laoqinren.net>
2017-05-15 15:35:43 +08:00
0x0916
7c9d733f3d add more detail for blkio
This patch add Read and Write information for blkio bytes.

Signed-off-by: 0x0916 <w@laoqinren.net>
2017-05-15 14:46:23 +08:00
Christian Brauner
7e0ed7ffa0 Merge pull request #1560 from dimkr/master
conf: fix build without libcap
2017-05-14 11:59:52 +02:00
Dima Krasner
bc5b27d6f6 conf: fix build without libcap
Signed-off-by: Dima Krasner <samdima@securingsam.com>
2017-05-14 12:40:02 +03:00
Stéphane Graber
1dd898cc99 Merge pull request #1553 from brauner/2017-05-12/allow_no_controlling_terminal
lxc-attach: allow for situations without /dev/tty
2017-05-13 16:18:30 -04:00
Serge Hallyn
66806d2432 Merge pull request #1551 from brauner/2017-05-11/fix_num_parsing
utils: fix num parsing functions
2017-05-13 14:46:45 -05:00
Serge Hallyn
fbe5c36ec2 Merge pull request #1556 from brauner/2017-05-13/fix_newuidmap_regression
start: don't call lxc_map_ids() without id map
2017-05-13 14:39:07 -05:00
Christian Brauner
57927bf255
start: don't call lxc_map_ids() without id map
So far, we somehow always called lxc_map_ids(), even when no id map was
configured. Let's not do this.

Closes #1555.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-13 17:16:25 +02:00
Christian Brauner
6f18b9c483
lxc-attach: allow for situations without /dev/tty
Closes #1552.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-12 16:58:09 +02:00
Christian Brauner
15fe2189e6
tests: lxc_safe_{u}int() add corner-case tests
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-12 02:26:20 +02:00
Christian Brauner
643c19840f
utils: fix num parsing functions
Suggested-by: Benedikt Rosenkranz beluro@web.de
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-12 01:16:09 +02:00
Stéphane Graber
bd3dfa33e2 Merge pull request #1550 from brauner/2017-05-11/add_comment_to_lxc_spawn
start: add crucial details about lxc_spawn()
2017-05-11 11:10:19 -04:00
Christian Brauner
480588e6ad
start: add crucial details about lxc_spawn()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-11 14:41:47 +02:00
Christian Brauner
bb51d6b135 Merge pull request #1549 from 0x0916/install-systemd-unit-for-centos
Install systemd units for CentOS
2017-05-11 12:14:08 +02:00
0x0916
82b479119d Merge ubuntu and debiancase
Signed-off-by: 0x0916 <w@laoqinren.net>
2017-05-11 15:16:14 +08:00
0x0916
234f9815ff Install systemd units for CentOS
Signed-off-by: 0x0916 <w@laoqinren.net>
2017-05-11 15:15:18 +08:00
Stéphane Graber
394c22055f Merge pull request #1548 from brauner/2017-05-10/prevent_umount_propagation
utils: handle > 2^31 in lxc_unstack_mountpoint()
2017-05-10 17:04:57 -04:00
Christian Brauner
b4a40f7b45
utils: handle > 2^31 in lxc_unstack_mountpoint()
I mean.. really? But better safe than sorry.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-10 18:28:09 +02:00
Serge Hallyn
60883ba8e1 Merge pull request #1547 from brauner/2017-05-10/prevent_umount_propagation
start: remove umount2()
2017-05-10 10:43:53 -05:00
Christian Brauner
39c7b795b1
conf: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-10 13:35:54 +02:00
Christian Brauner
58d5b52795
start: remove umount2()
I really fail to see the point of this and git {blame, log -S} don't really
enlighten me on the reason for this as well. But I might be dense. The way I
see it the only thing this line achieves is causing trouble when the container
is started as root because the umount2() call will umount e.g.
/usr/lib/x86_64-linux-gnu/lxc in case it is a mountpoint on the host. Note,
this is because lxc_spawn() is still called in the hosts namespaces.

Closes https://github.com/lxc/lxd/#3255.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-10 13:35:46 +02:00
Serge Hallyn
eb09dc4eb7 Merge pull request #1544 from brauner/2017-05-08/harden_console_handling
harden console handling
2017-05-10 00:31:03 -05:00
Christian Brauner
467c7ff315
console: fail when we cannot allocate peer tty
There's really no reason not to if it's requested.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-10 02:52:17 +02:00
Christian Brauner
a7ba3c7ff8
conf: unstack all mounts atop /dev/console
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-09 23:29:12 +02:00
Christian Brauner
74251e49bb
utils: add lxc_unstack_mountpoint()
lxc_unstack_mountpoint() tries to clear all mountpoints from a given path.
It return the number of successful umounts on success and -errno on error.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-09 23:27:47 +02:00
Christian Brauner
6e3bb2890c
doc: document console behavior
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-09 23:26:13 +02:00
Christian Brauner
2c056d3836
config: remove /dev/console bind mount
The code in conf will bind-mount a /dev/pts/<n> device over a dummy regular
/dev/console file. If users really want /dev/console bind-mount from the host
they can request it explicitly in the containers config file. This change will
have no effect on current LX{C,D} behavior since we (as said above) overmount
the /dev/console bind-mount anyway.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-09 23:24:29 +02:00
Christian Brauner
2a12fefd8d
conf: lxc_setup_ttydir_console()
In case the user specified

lxc.console = none
lxc.devttydir = bla
lxc.mount.entry = /dev/console dev/console none bind,create=file 0 0

move the mount under /dev/bla/console

If he requested a mknod()ed /dev/console rename it to /dev/bla/console.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-09 23:21:24 +02:00
Christian Brauner
8b1b121003
conf: improve lxc_setup_dev_console()
In case the user did request a console to be set up unmount any prior
bind-mount for it.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-09 23:18:55 +02:00
Christian Brauner
3d7d929aff
conf: non-functional changes to console functions
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-09 23:17:23 +02:00
Christian Brauner
27245ff728
conf: non-functional changes lxc_setup()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-09 23:16:01 +02:00
0x0916
9fd8b8a785 fix the wrong exit status
Signed-off-by: 0x0916 <w@laoqinren.net>
2017-05-09 02:24:41 +02:00
Christian Brauner
4d78c48e29
conf: remove /dev/console from lxc_fill_autodev()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-09 00:23:51 +02:00
Christian Brauner
0bbf8572ba
conf: non-functional changes lxc_fill_autodev()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-09 00:23:51 +02:00
Stéphane Graber
218a8306c2 Merge pull request #1539 from brauner/2017-05-06/fix_abstract_unix_sockets
bugfixes: {segfaults, hashes, abstract unix sockets}
2017-05-08 18:08:22 -04:00
Christian Brauner
5c77e2ff8b Merge pull request #1543 from evgeni/patch-1
precise is not the latest LTS, let's use xenial instead
2017-05-08 21:04:36 +02:00
Evgeni Golov
ecb5208b42 precise is not the latest LTS, let's use xenial instead 2017-05-08 14:56:04 -04:00
Christian Brauner
fcaef9c7dd
monitor: simplify abstract socket logic
Older version of liblxc only allowed for 105 bytes to be used for the abstract
unix domain socket name because the code for our abstract unix socket handling
performed invalid checks. Since we \0-terminate we could now have a maximum of
106 chars. But do not break backwards compatibility we keep the limit at 105.

Reported-by: 0x0916 w@laoqinren.net
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-08 12:15:44 +02:00
Christian Brauner
899a9f5545
lxccontainer: avoid NULL pointer dereference
In case the lxc command socket is hashed and the socket was created for a
different path than the one we're currently querying
lxc_cmd_get_{lxcpath,name}() can return NULL. The command socket path is hashed
when len(lxcpath) > sizeof(sun_path) - 2.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-08 12:15:44 +02:00
Christian Brauner
860e7c4311
commands: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-08 12:15:43 +02:00
Christian Brauner
c54a4aeeb5
commands: avoid NULL pointer dereference
lxc_cmd_get_lxcpath() and lxc_cmd_get_name() both pass a nil pointer to
fill_sock_name(). Make sure that they are not dereferenced.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-08 12:15:43 +02:00
Christian Brauner
caf3beb02d
af unix: allow for maximum socket name
Abstract unix sockets need not be \0-terminated. So you can effectively have
107 chars available. If you \0-terminate you'll have a 106. Don't enforce
\0-termination in these low-level functions. Enforce it higher up which we
already do.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-08 12:15:43 +02:00
Serge Hallyn
55b8c7557a Merge pull request #1537 from brauner/2017-05-05/report_errno_on_monitor_startup_failure
monitor: report errno on exec() error
2017-05-05 22:33:51 -05:00
Christian Brauner
00cccc8bd2
monitor: report errno on exec() error
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-05 14:37:27 +02:00