Commit Graph

5109 Commits

Author SHA1 Message Date
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
Stéphane Graber
f5351e2437 Merge pull request #1533 from brauner/2017-05-02/mount_opts
conf: pedantry
2017-05-03 18:35:46 -04:00
Stéphane Graber
2a902a63c5 Merge pull request #1535 from brauner/2017-05-03/api_extension_lxc_is_supported_config_item
api extension: lxc_config_item_is_supported()
2017-05-03 18:35:27 -04:00
Christian Brauner
add40e6270
test: add lxc_config_item_is_supported() tests
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-03 12:24:39 +02:00
Christian Brauner
1246142888
lxccontainer: add lxc_config_item_is_supported()
This adds lxc_config_item_is_supported() as API extension. It allows to check
whether a given config item (e.g. lxc.autodev) is supported by this LXC
instance. The function is useful in the following scenarios:
1. Users have compiled liblxc from source and have removed a config items from
   the corresponding struct in confile.c. (For example, embedded users might
   decide to gut a bunch of options that they cannot use.)
2. Callers that want to check for a specific configuration item independent of
   the version numbers exposed in our version.h header.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-03 12:12:22 +02:00
Christian Brauner
8912711cac
conf: add MS_LAZYTIME to mount options
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-03 11:15:00 +02:00
Christian Brauner
470b359b9d
conf: order mount options
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-05-02 23:37:16 +02:00
Stéphane Graber
2c0807c7c4 Merge pull request #1531 from mar-kolya/master
Change sshd template to work with Ubuntu 17.04
2017-05-02 00:07:37 -04:00
Nikolay Martynov
a0430b2f97 Change sshd template to work with Ubuntu 17.04
A few things have changed and this patch makes container generated for sshd work in Ubuntu

Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
2017-05-01 21:45:10 -04:00
Serge Hallyn
c0614b0c23 Merge pull request #1529 from brauner/2017-04-28/create_proc_if_missing
utils: tweak lxc_mount_proc_if_needed()
2017-04-28 20:06:07 -05:00
Christian Brauner
fc2ad9dcdd
utils: tweak lxc_mount_proc_if_needed()
Create /proc directory if it doesn't exist.

Closes #1475.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-04-29 00:05:42 +02:00
Christian Brauner
943144d931
conf: non-functional changes
Closes #1475.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-04-29 00:05:29 +02:00