Commit Graph

5245 Commits

Author SHA1 Message Date
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
Serge Hallyn
1545a1f163 Merge pull request #1528 from brauner/2017-04-28/close_fd_in_lxc_setup_devpts
conf: close fd in lxc_setup_devpts()
2017-04-28 09:44:08 -05:00
Christian Brauner
e87bd19ceb
conf: close fd in lxc_setup_devpts()
This left the file descriptor to the underlying /dev/ptmx file open which
confused the hell out of criu. Let's close it.

Closes https://github.com/lxc/lxd/issues/3243.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-04-28 15:19:17 +02:00
Christian Brauner
da1ef68cae Merge pull request #1527 from tenforward/japanese
doc: add lxc.limit to lxc.container.conf(5)
2017-04-25 11:09:03 +02:00
KATOH Yasufumi
e7267b539e doc: add lxc.limit to lxc.container.conf(5)
Update for commit 93f9e90

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2017-04-25 17:33:36 +09:00
Stéphane Graber
50fce81cd9 Merge pull request #1526 from brauner/2017-04-24/build_lxc_with_musl
confile: fix musl build
2017-04-23 21:55:44 -04:00
Christian Brauner
2e6e3febb1
confile: fix musl build
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-04-24 00:34:48 +02:00
Stéphane Graber
e85e742c9c Merge pull request #1523 from brauner/2017-04-23/improve_cgfsng_debug
cgroups: improve cgfsng debugging
2017-04-23 16:50:56 -04:00
Christian Brauner
0bc4a8473d
issue template: fix typo
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-04-23 22:04:54 +02:00
Christian Brauner
e4aeecf54b
cgroups: improve cgfsng debugging
In a lot of cases we need a list of the writeable cgroup controllers detected
by the cgfsng driver.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-04-23 15:06:10 +02:00
Stéphane Graber
2e2cbfd21b Merge pull request #1520 from brauner/2017-04-22/improve_loop
utils: use loop device helpers from LXD
2017-04-22 21:10:10 -04:00
Stéphane Graber
170a37711e Merge pull request #1522 from brauner/2017-04-22/lxc_issue_template
create ISSUE_TEMPLATE.md
2017-04-22 21:09:44 -04:00
Christian Brauner
8b62db216e
create ISSUE_TEMPLATE.md
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-04-22 18:40:36 +02:00
Christian Brauner
c6868a1f81
utils: use loop device helpers from LXD
Use the loop device helpers I wrote for LXD in LXC as well. They should be more
efficient.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-04-22 14:04:34 +02:00
Christian Brauner
d435aae15b
conf: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-04-22 14:01:53 +02:00