]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
7 years agotools/lxc_usernsexec: removed internal logging
AustinReichert [Tue, 28 Nov 2017 23:54:11 +0000 (17:54 -0600)] 
tools/lxc_usernsexec: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_unshare: removed internal logging
AustinReichert [Tue, 28 Nov 2017 23:48:06 +0000 (17:48 -0600)] 
tools/lxc_unshare: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_unfreeze: removed internal logging
AustinReichert [Tue, 28 Nov 2017 23:38:48 +0000 (17:38 -0600)] 
tools/lxc_unfreeze: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_top: removed internal logging
AustinReichert [Tue, 28 Nov 2017 23:35:45 +0000 (17:35 -0600)] 
tools/lxc_top: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_stop: removed internal logging
AustinReichert [Tue, 28 Nov 2017 23:29:25 +0000 (17:29 -0600)] 
tools/lxc_stop: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_start: removed internal logging
AustinReichert [Tue, 28 Nov 2017 23:16:07 +0000 (17:16 -0600)] 
tools/lxc_start: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agotools/lxc_snapshot: removed internal logging
AustinReichert [Tue, 28 Nov 2017 23:07:24 +0000 (17:07 -0600)] 
tools/lxc_snapshot: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_monitor: removed internal logging
AustinReichert [Tue, 28 Nov 2017 22:59:14 +0000 (16:59 -0600)] 
tools/lxc_monitor: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_copy: remove internal logging
AustinReichert [Tue, 28 Nov 2017 22:56:17 +0000 (16:56 -0600)] 
tools/lxc_copy: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_ls: remove internal logging
AustinReichert [Tue, 28 Nov 2017 22:50:16 +0000 (16:50 -0600)] 
tools/lxc_ls: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agobtrfs: fix btrfs_snapshot()
Christian Brauner [Tue, 28 Nov 2017 12:51:03 +0000 (13:51 +0100)] 
btrfs: fix btrfs_snapshot()

Closes #1956.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
7 years agostorage: constify where possible
Christian Brauner [Tue, 28 Nov 2017 12:39:15 +0000 (13:39 +0100)] 
storage: constify where possible

This was made necessary by changes to the overlay driver.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
7 years agostorage: remove unused declaration
Christian Brauner [Tue, 28 Nov 2017 11:47:59 +0000 (12:47 +0100)] 
storage: remove unused declaration

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
7 years agostorage: make storage_copy() cleaner
Christian Brauner [Tue, 28 Nov 2017 11:40:22 +0000 (12:40 +0100)] 
storage: make storage_copy() cleaner

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
7 years agolxccontainer: various container creation fixes
Christian Brauner [Tue, 28 Nov 2017 11:32:05 +0000 (12:32 +0100)] 
lxccontainer: various container creation fixes

This is beneficial for LXD as well.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
7 years agostorage: make storage_init() smart and simplify
Christian Brauner [Tue, 28 Nov 2017 11:02:54 +0000 (12:02 +0100)] 
storage: make storage_init() smart and simplify

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
7 years agostorage: make storage_dir() smart
Christian Brauner [Tue, 28 Nov 2017 10:44:49 +0000 (11:44 +0100)] 
storage: make storage_dir() smart

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
7 years agoloop: adapt to new config rootfs parser
Christian Brauner [Tue, 28 Nov 2017 00:16:34 +0000 (01:16 +0100)] 
loop: adapt to new config rootfs parser

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
7 years agooverlay: adapt to new config rootfs parser
Christian Brauner [Tue, 28 Nov 2017 00:12:36 +0000 (01:12 +0100)] 
overlay: adapt to new config rootfs parser

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
7 years agostorage: pass down storage type
Christian Brauner [Mon, 27 Nov 2017 23:57:09 +0000 (00:57 +0100)] 
storage: pass down storage type

The configuration file parser now already detects the storage type so spare the
work and pass it down to the storage drivers.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
7 years agoconfile: parse storage type
Christian Brauner [Mon, 27 Nov 2017 12:01:22 +0000 (13:01 +0100)] 
confile: parse storage type

Split lxc.rootfs.path = <storage type>:<container path> into <storage-type> and
<container path> to set the storage type and rootfs path value correctly.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
7 years agocriu: detect veth name
Christian Brauner [Mon, 27 Nov 2017 11:28:44 +0000 (12:28 +0100)] 
criu: detect veth name

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
7 years agotools/lxc_info: removed internal logging
AustinReichert [Tue, 28 Nov 2017 09:34:42 +0000 (03:34 -0600)] 
tools/lxc_info: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_freeze: remove internal logging
AustinReichert [Tue, 28 Nov 2017 09:32:50 +0000 (03:32 -0600)] 
tools/lxc_freeze: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_execute: removed internal logging
AustinReichert [Tue, 28 Nov 2017 09:30:24 +0000 (03:30 -0600)] 
tools/lxc_execute: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_device: remove internal logging
AustinReichert [Tue, 28 Nov 2017 09:26:25 +0000 (03:26 -0600)] 
tools/lxc_device: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_destroy: remove internal logging
AustinReichert [Tue, 28 Nov 2017 09:19:29 +0000 (03:19 -0600)] 
tools/lxc_destroy: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_create: remove internal logging
AustinReichert [Tue, 28 Nov 2017 09:14:54 +0000 (03:14 -0600)] 
tools/lxc_create: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_console: remove internal logging
AustinReichert [Tue, 28 Nov 2017 08:52:16 +0000 (02:52 -0600)] 
tools/lxc_console: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_clone: remove internal logging
AustinReichert [Tue, 28 Nov 2017 08:41:23 +0000 (02:41 -0600)] 
tools/lxc_clone: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_autostart: remove internal logging
AustinReichert [Tue, 28 Nov 2017 07:12:18 +0000 (01:12 -0600)] 
tools/lxc_autostart: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_cgroup: remove internal logging
AustinReichert [Tue, 28 Nov 2017 06:43:46 +0000 (00:43 -0600)] 
tools/lxc_cgroup: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agoutils.h: Avoid duplicated sethostname implementation
Marcos Paulo de Souza [Tue, 28 Nov 2017 01:48:57 +0000 (23:48 -0200)] 
utils.h: Avoid duplicated sethostname implementation

Move duplicated implementatin of sethostname from conf.c and
lxc_unshare.c to utils.h

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
7 years agoUse AX_PTHREAD config script to detect pthread api
Marcos Paulo de Souza [Sun, 26 Nov 2017 18:45:22 +0000 (16:45 -0200)] 
Use AX_PTHREAD config script to detect pthread api

Closes: #84
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
7 years agostart.c: always switch uid and gid
Yifeng Tan [Fri, 24 Nov 2017 12:03:47 +0000 (20:03 +0800)] 
start.c: always switch uid and gid

Signed-off-by: Yifeng Tan <tanyifeng1@huawei.com>
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconf: move CAP_SYS_* definitions to utils.h
Christian Brauner [Fri, 24 Nov 2017 12:23:35 +0000 (13:23 +0100)] 
conf: move CAP_SYS_* definitions to utils.h

Closes #1946.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoFixed typo on lxc.spec.in
David Negreira [Thu, 23 Nov 2017 20:23:14 +0000 (21:23 +0100)] 
Fixed typo on lxc.spec.in

Signed-off-by: David Negreira David@otherreality.net
7 years agoconfile: improve legacy update message
Christian Brauner [Wed, 22 Nov 2017 22:24:40 +0000 (23:24 +0100)] 
confile: improve legacy update message

Closes #1938.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolxc-test-unpriv: check user existence before removing it
Po-Hsu Lin [Wed, 22 Nov 2017 08:11:34 +0000 (03:11 -0500)] 
lxc-test-unpriv: check user existence before removing it

Check the test user (lxcunpriv) before calling deluser command,
otherwise it will print unnecessary error message:
/usr/sbin/deluser: The user 'lxcunpriv' does not exist.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
7 years agoconfile_utils: fix overlapping strncpy
Felix Abecassis [Wed, 22 Nov 2017 06:27:19 +0000 (22:27 -0800)] 
confile_utils: fix overlapping strncpy

In the case of "lxc.net.0.type", the pointers passed to strncpy were
only 2 elements apart, resulting in undefined behavior.

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
7 years agolxc_init: set the control terminal in the child session
Jonathan Calmels [Tue, 21 Nov 2017 01:30:45 +0000 (17:30 -0800)] 
lxc_init: set the control terminal in the child session

Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
7 years agocommands: fix state socket implementation
Christian Brauner [Mon, 20 Nov 2017 21:16:40 +0000 (22:16 +0100)] 
commands: fix state socket implementation

Remove dead state clients from state client list. Consider the following
scenario:

01 start container
02 issue shutdown request
03 state_client_fd is added to lxc_handler
03 container doesn't respond to shutdown request
04 user aborts shutdown request
05 lxc_cmd_fd_cleanup() removes state_client_fd from lxc_mainloop
06 invalid state_client_fd is still recorded in the lxc_handler
07 user issues lxc_cmd_stop() request via SIGKILL
08 container reaches STOPPED state and sends message to state_client_fd
09 state_client_fd number has been reused by lxc_cmd_stop_callback()
10 invalid data gets dumped to lxc_cmd_stop()

Reproducer:
Set an invalid shutdown signal to which the init system does not respond with a
shutdown via lxc.signal.halt e.g. "lxc.signal.halt = SIGUSR1". Then do:

1. start container
    root@conventiont|~
    > lxc-start -n a1

2. try to shutdown container
    root@conventiont|~
    > lxc-stop -n a1

3. abort shutdown
^C

4. SIGKILL the container (lxc.signal.stop = SIGKILL)
    root@conventiont|~
    > lxc-stop -n a1 -k
    lxc-stop: a1: commands.c: lxc_cmd_rsp_recv: 165 File too large - Response data for command "stop" is too long: 12641 bytes > 8192

To not let this happen we remove the state_client_fd from the lxc_handler when
we detect a cleanup event in lxc_cmd_fd_cleanup().

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolxccontainer: non-functional changes
Christian Brauner [Mon, 20 Nov 2017 15:50:00 +0000 (16:50 +0100)] 
lxccontainer: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocommands: non-functional changes
Christian Brauner [Mon, 20 Nov 2017 15:49:30 +0000 (16:49 +0100)] 
commands: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolvm: generate new UUID for xfs + btrfs filesystems
Christian Brauner [Mon, 13 Nov 2017 14:01:42 +0000 (15:01 +0100)] 
lvm: generate new UUID for xfs + btrfs filesystems

Closes #1909.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconsole: exit mainloop on SIGTERM
Christian Brauner [Sun, 12 Nov 2017 16:51:11 +0000 (17:51 +0100)] 
console: exit mainloop on SIGTERM

This allows cleanly exiting a console session without control sequences.

Relates to https://github.com/lxc/lxd/pull/4001 .

Note that the existence of a signal handler now doesn't guarantee that ts->node
is allocated. Instead, ts->node will now only be added to if stdinfd is a tty.
New checks need to take that into account.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconsole: prepare for generic signal handler
Christian Brauner [Sun, 12 Nov 2017 14:25:19 +0000 (15:25 +0100)] 
console: prepare for generic signal handler

Non-functional changes to enable handling more signals.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconsole: use correct escape sequence check
Christian Brauner [Sat, 11 Nov 2017 22:05:33 +0000 (23:05 +0100)] 
console: use correct escape sequence check

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolxccontainer: enable daemonized app containers
Christian Brauner [Fri, 10 Nov 2017 23:21:09 +0000 (00:21 +0100)] 
lxccontainer: enable daemonized app containers

This enables daemonized application containers with our minimal init running as
pid one and the requested program running as second pid.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconsole: report detach message on demand
Christian Brauner [Fri, 10 Nov 2017 18:51:57 +0000 (19:51 +0100)] 
console: report detach message on demand

When users pass -1 there's there won't be an escape sequence to exit the
console so no need to print a misleading info message about how to detach.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocgroups/cgfsng: adapt to new cgroup2 delegation
Christian Brauner [Wed, 8 Nov 2017 00:50:55 +0000 (01:50 +0100)] 
cgroups/cgfsng: adapt to new cgroup2 delegation

In order to enable proper unprivileged cgroup delegation on newer kernels we not
just need to delegate the "cgroup.procs" file but also "cgroup.threads". But
don't report an error in case it doesn't exist. Also delegate
"cgroup.subtree_control" to enable delegation of controllers to descendant
cgroups.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoAdd missing dependency libunistring
CC-Hsu [Fri, 10 Nov 2017 15:22:29 +0000 (23:22 +0800)] 
Add missing dependency libunistring

Hi,

I try to create a Slackware container in a Slackware64 14.2 current and
find that wget depends on libunistring.

So I add libunistring to the package list.

Closes #1915

Signed-off-by: Chia-Chun Hsu a12321aabb@gmail.com
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
7 years agoconsole: fix console info message
Christian Brauner [Fri, 10 Nov 2017 18:07:38 +0000 (19:07 +0100)] 
console: fix console info message

Now it will be displayed nicely formatted:

a1 login: chb@conventiont|~
> lxc console a1

Connected to tty 0
Type <Ctrl+a q> to exit the console, <Ctrl+a Ctrl+a> to enter Ctrl+a itself

Ubuntu 17.10 a1 console

a1 login:

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agotools/lxc_attach: removed api logging
Austin Reichert [Thu, 9 Nov 2017 23:33:29 +0000 (17:33 -0600)] 
tools/lxc_attach: removed api logging

Signed-off-by: Austin Reichert <austinskyreichert@utexas.edu>
7 years agoattach: allow attach with empty conf
Christian Brauner [Wed, 8 Nov 2017 21:13:48 +0000 (22:13 +0100)] 
attach: allow attach with empty conf

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolxc-test-unpriv: fix the overlayfs mount error
Po-Hsu Lin [Wed, 8 Nov 2017 09:13:58 +0000 (04:13 -0500)] 
lxc-test-unpriv: fix the overlayfs mount error

This patch fixes the missing workdir issue for the overlayfs mount command in
the lxc-test-unpriv test.

link: https://bugs.launchpad.net/bugs/1730915
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
7 years agoconsole: non-functional changes
Christian Brauner [Thu, 26 Oct 2017 15:33:10 +0000 (17:33 +0200)] 
console: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconsole: non-functional changes
Christian Brauner [Mon, 23 Oct 2017 11:41:33 +0000 (13:41 +0200)] 
console: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocommands: non-functional changes
Christian Brauner [Sun, 22 Oct 2017 20:11:33 +0000 (22:11 +0200)] 
commands: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconfig: remove SIGRTMIN+14 as lxc.signal.stop
Christian Brauner [Tue, 31 Oct 2017 21:19:38 +0000 (22:19 +0100)] 
config: remove SIGRTMIN+14 as lxc.signal.stop

We want to be able to SIGKILL an Archlinux container.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocgroupfs/cgfsng: improve cgroup2 handling
Christian Brauner [Tue, 31 Oct 2017 16:07:57 +0000 (17:07 +0100)] 
cgroupfs/cgfsng: improve cgroup2 handling

This fixes a bunch of bugs.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocgroups/cgfsng: fix get_controllers() for cgroup2
Christian Brauner [Tue, 31 Oct 2017 16:06:58 +0000 (17:06 +0100)] 
cgroups/cgfsng: fix get_controllers() for cgroup2

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocgroups/cgfsng: remove is_lxcfs()
Christian Brauner [Wed, 1 Nov 2017 10:13:18 +0000 (11:13 +0100)] 
cgroups/cgfsng: remove is_lxcfs()

We don't need to parse fuse.lxcfs entries.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocgroupfs/cgfsng: tweak logging
Christian Brauner [Tue, 31 Oct 2017 16:05:22 +0000 (17:05 +0100)] 
cgroupfs/cgfsng: tweak logging

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolog: check for i/o error with vsnprintf()
Christian Brauner [Tue, 31 Oct 2017 11:05:13 +0000 (12:05 +0100)] 
log: check for i/o error with vsnprintf()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocgroups/cgfsng: support MS_READONLY with cgroup ns
Christian Brauner [Tue, 31 Oct 2017 11:01:29 +0000 (12:01 +0100)] 
cgroups/cgfsng: support MS_READONLY with cgroup ns

If we lack CAP_SYS_ADMIN this is really useful.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocgroups/cgfsng: cgfsns_chown() -> cgfsng_chown()
Christian Brauner [Tue, 31 Oct 2017 10:16:46 +0000 (11:16 +0100)] 
cgroups/cgfsng: cgfsns_chown() -> cgfsng_chown()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocgroups/cgfsng: make sure pointer is NULL
Christian Brauner [Tue, 31 Oct 2017 10:55:23 +0000 (11:55 +0100)] 
cgroups/cgfsng: make sure pointer is NULL

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocgroups/cgfsng: keep mountpoint intact
Christian Brauner [Tue, 31 Oct 2017 10:15:07 +0000 (11:15 +0100)] 
cgroups/cgfsng: keep mountpoint intact

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoattach: handle namespace inheritance
Christian Brauner [Wed, 1 Nov 2017 09:44:18 +0000 (10:44 +0100)] 
attach: handle namespace inheritance

We need to have lxc_attach() distinguish between a caller specifying specific
namespaces to attach to and a caller not requesting specific namespaces. The
latter is taken by lxc_attach() to mean that all namespaces will be attached.
This also needs to include all inherited namespaces.

Closes #1890.
Closes #1897.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agotools: fix help output of lxc-create
Christian Brauner [Mon, 6 Nov 2017 11:54:06 +0000 (12:54 +0100)] 
tools: fix help output of lxc-create

Closes #1899.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agostorage: switch to ext4 as default filesystem
Christian Brauner [Mon, 6 Nov 2017 11:52:43 +0000 (12:52 +0100)] 
storage: switch to ext4 as default filesystem

Closes #1899.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolxc/start.c: Fix legacy PR_{G,S}ET_NO_NEW_PRIVS handling
Peter Korsgaard [Mon, 6 Nov 2017 08:35:48 +0000 (09:35 +0100)] 
lxc/start.c: Fix legacy PR_{G,S}ET_NO_NEW_PRIVS handling

The configure checks for these use AC_CHECK_DECLS, which define the symbol
to 0 if not available - So adjust the code to match.  From the autoconf
manual:

https://www.gnu.org/software/autoconf/manual/autoconf-2.65/html_node/Generic-Declarations.html)

For each of the symbols (comma-separated list), define HAVE_DECL_symbol (in
all capitals) to ‘1’ if symbol is declared, otherwise to ‘0’.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
7 years agoconf: reap child in all cases
Christian Brauner [Wed, 1 Nov 2017 20:58:24 +0000 (21:58 +0100)] 
conf: reap child in all cases

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agonetwork: reap child in all cases
Christian Brauner [Wed, 1 Nov 2017 20:52:07 +0000 (21:52 +0100)] 
network: reap child in all cases

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agomonitor: do not log useless warnings
Christian Brauner [Sun, 29 Oct 2017 16:26:13 +0000 (17:26 +0100)] 
monitor: do not log useless warnings

lxc-monitord is deprecated so this is expected to fail.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agostart: close data socket in parent
Christian Brauner [Sun, 29 Oct 2017 16:03:57 +0000 (17:03 +0100)] 
start: close data socket in parent

Brings the number of open fds in the monitor process for a standard container
without ttys down to 17.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agohandler: make name argument const
Christian Brauner [Sat, 28 Oct 2017 20:05:18 +0000 (22:05 +0200)] 
handler: make name argument const

There's no obvious need to strdup() the name of the container in the handler.
We can simply make this a pointer to the memory allocated in
lxc_container_new().

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agostart: close non-needed file descriptors
Christian Brauner [Sun, 29 Oct 2017 12:07:46 +0000 (13:07 +0100)] 
start: close non-needed file descriptors

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolxc-start: remove unnecessary checks
Christian Brauner [Sat, 28 Oct 2017 13:30:04 +0000 (15:30 +0200)] 
lxc-start: remove unnecessary checks

The console struct is internal and liblxc takes care of creating paths.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoFix compilation on toolchain without prlimit
Fabrice Fontaine [Thu, 2 Nov 2017 15:00:33 +0000 (16:00 +0100)] 
Fix compilation on toolchain without prlimit

Some toolchains which are not bionic like uclibc does not support
prlimit or prlimit64. In this case, return an error.
Moreover, if prlimit64 is available, use lxc implementation of prlimit.

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
7 years agocgroups: enable container without CAP_SYS_ADMIN
Christian Brauner [Mon, 30 Oct 2017 13:16:46 +0000 (14:16 +0100)] 
cgroups: enable container without CAP_SYS_ADMIN

In case cgroup namespaces are supported but we do not have CAP_SYS_ADMIN we
need to mount cgroups for the container. This patch enables both privileged and
unprivileged containers without CAP_SYS_ADMIN.

Closes #1737.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocgfsng: fix cgroup2 detection
Christian Brauner [Mon, 30 Oct 2017 13:17:20 +0000 (14:17 +0100)] 
cgfsng: fix cgroup2 detection

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoattach: correctly handle namespace inheritance
Christian Brauner [Sun, 29 Oct 2017 11:19:43 +0000 (12:19 +0100)] 
attach: correctly handle namespace inheritance

When attaching to a container's namespaces we did not handle the case where we
inherited namespaces correctly. In essence, liblxc on start records the
namespaces the container was created with in the handler. But it only records
the clone flags that were passed to clone() and doesn't record the namespaces
we e.g. inherited from other containers. This means that attach only ever
attached to the clone flags. But this is only correct if all other namespaces
not recorded in the handler refer to the namespaces of the caller. However,
this need not be the case if the container has inherited namespaces from
another container. To handle this case we need to check whether caller and
container are in the same namespace. If they are, we know that things are all
good. If they aren't then we need to attach to these namespaces as well.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoAdd missing lxc_container_put
Jordan Webb [Fri, 27 Oct 2017 18:30:49 +0000 (13:30 -0500)] 
Add missing lxc_container_put

Signed-off-by: Jordan Webb <jordemort@github.com>
7 years agoCall lxc_config_define_load from lxc_execute again
Jordan Webb [Fri, 27 Oct 2017 16:53:32 +0000 (11:53 -0500)] 
Call lxc_config_define_load from lxc_execute again

Signed-off-by: Jordan Webb <jordemort@github.com>
7 years agonamespace: use lxc_getpagesize()
Christian Brauner [Sat, 21 Oct 2017 14:27:34 +0000 (16:27 +0200)] 
namespace: use lxc_getpagesize()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconf: lxc_setup() -> lxc_setup_child()
Christian Brauner [Wed, 18 Oct 2017 18:24:54 +0000 (20:24 +0200)] 
conf: lxc_setup() -> lxc_setup_child()

Closes #1857.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconfile_utils: add lxc_get_conf_uint64()
Christian Brauner [Wed, 18 Oct 2017 14:20:01 +0000 (16:20 +0200)] 
confile_utils: add lxc_get_conf_uint64()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoutils: add lxc_find_next_power2()
Christian Brauner [Wed, 18 Oct 2017 19:20:37 +0000 (21:20 +0200)] 
utils: add lxc_find_next_power2()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoutils: parse_byte_size_string()
Christian Brauner [Wed, 18 Oct 2017 17:53:37 +0000 (19:53 +0200)] 
utils: parse_byte_size_string()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoutils: add lxc_safe_long_long()
Christian Brauner [Wed, 18 Oct 2017 17:53:17 +0000 (19:53 +0200)] 
utils: add lxc_safe_long_long()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoutils: add lxc_getpagesize()
Christian Brauner [Sat, 21 Oct 2017 14:22:58 +0000 (16:22 +0200)] 
utils: add lxc_getpagesize()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoutils: add lxc_make_tmpfile()
Christian Brauner [Wed, 18 Oct 2017 17:48:57 +0000 (19:48 +0200)] 
utils: add lxc_make_tmpfile()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoutils: add lxc_cloexec()
Christian Brauner [Wed, 18 Oct 2017 17:48:29 +0000 (19:48 +0200)] 
utils: add lxc_cloexec()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoutils: move memfd_create() definition
Christian Brauner [Wed, 18 Oct 2017 11:36:36 +0000 (13:36 +0200)] 
utils: move memfd_create() definition

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolxc-debian: don't hardcode valid releases
Antonio Terceiro [Sat, 28 Oct 2017 11:20:35 +0000 (09:20 -0200)] 
lxc-debian: don't hardcode valid releases

This avoids the dance of updating the list of valid releases every time
Debian makes a new release.

It also fixes the following bug: even though lxc-debian will default to
creating containers of the latest stable by querying the archive, it
won't allow you to explicitly request `stable` because the current list
of valid releases don't include it.

Last, but not least, avoid hitting the mirror in the case the desired
release is one of the ones we know will always be there, i.e. stable,
testing, sid, and unstable.

Signed-off-by: Antonio Terceiro <terceiro@debian.org>
7 years agolxc-debian: don't write C.* locales to /etc/locale.gen
Antonio Terceiro [Fri, 27 Oct 2017 19:13:54 +0000 (17:13 -0200)] 
lxc-debian: don't write C.* locales to /etc/locale.gen

Doing that confuses locale generation. lxc-ubuntu does the same check

Signed-off-by: Antonio Terceiro <terceiro@debian.org>
7 years agoFix typo in lxc-net script
adrian5 [Thu, 26 Oct 2017 23:47:37 +0000 (01:47 +0200)] 
Fix typo in lxc-net script

Signed-off-by: adrian5 <adrian5@users.noreply.github.com>
7 years agolxc-debian: allow creating `testing` and `unstable`
Antonio Terceiro [Thu, 26 Oct 2017 22:42:49 +0000 (20:42 -0200)] 
lxc-debian: allow creating `testing` and `unstable`

Being able to create `testing` containers, regardless of what's the name
of the next stable, is useful in several contexts, included but not
limited to testing purposes. i.e. one won't need to explicitly switch to
`bullseye` once `buster` is released to be able to continue tracking
`testing`. While we are at it, let's also enable `unstable`, which is
exactly the same as `sid`, but there is no reason for not being able to.

Signed-off-by: Antonio Terceiro <terceiro@debian.org>