]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
6 years agorename am_unpriv to am_host_unpriv
Tycho Andersen [Fri, 26 Jan 2018 22:11:09 +0000 (22:11 +0000)]
rename am_unpriv to am_host_unpriv

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
6 years agobetter unprivileged detection
Tycho Andersen [Fri, 26 Jan 2018 21:21:51 +0000 (21:21 +0000)]
better unprivileged detection

In particular, if we are already in a user namespace we are unprivileged,
and doing things like moving the physical nics back to the host netns won't
work. Let's do the same thing LXD does if euid == 0: inspect
/proc/self/uid_map and see what that says.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
6 years agobetter check for lock dir
Tycho Andersen [Fri, 26 Jan 2018 17:43:12 +0000 (17:43 +0000)]
better check for lock dir

Consider the case where we're running in a user namespace but in the host's
mount ns with the host's filesystem (something like
lxc-usernsexec ... lxc-execute ...), in this case, we'll be euid 0, but we
can't actually write to /run. Let's improve this locking check to make sure
we can actually write to /run before we decide to actually use it as our
locking dir.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
6 years agoMerge pull request #2109 from duguhaotian/new
Christian Brauner [Fri, 26 Jan 2018 13:54:35 +0000 (14:54 +0100)]
Merge pull request #2109 from duguhaotian/new

[cgfsng] show wrong errno

6 years ago[cgfsng] show wrong errno
duguhaotian [Fri, 26 Jan 2018 13:07:58 +0000 (21:07 +0800)]
[cgfsng] show wrong errno

lxc_cgroup_set_data: h = get_hierarchy(controller);
if h is NULL, now errno is old, it donot set new one.
And then,
cgfsng_setup_limits:

    if (lxc_cgroup_set_data(cg->subsystem, cg->value, d)) {
if (do_devices && (errno == EACCES ||
errno == EPERM)) {
WARN("Error setting %s to %s for %s",
cg->subsystem, cg->value,
d->name);
continue;
}
SYSERROR("Error setting %s to %s for
 %s",
 cg->subsystem, cg->value,
 d->name);
goto out;
}

SYSERROR will show old errno, make me confused.

Signed-off-by: duguhaotian <duguhaotian@gmail.com>
6 years agoMerge pull request #2099 from brauner/2018-01-20/attach_init_pty
Stéphane Graber [Wed, 24 Jan 2018 20:24:46 +0000 (22:24 +0200)]
Merge pull request #2099 from brauner/2018-01-20/attach_init_pty

bugfixes

6 years agoMerge pull request #2103 from marcosps/forward_not_used
Christian Brauner [Tue, 23 Jan 2018 10:31:53 +0000 (11:31 +0100)]
Merge pull request #2103 from marcosps/forward_not_used

network.c: Remove ip_forward_set and callers

6 years agonetwork.c: Remove ip_forward_set and callers
Marcos Paulo de Souza [Tue, 23 Jan 2018 00:04:03 +0000 (22:04 -0200)]
network.c: Remove ip_forward_set and callers

The last user of ip_forward_set, lxc_ip_forward_on and
lxc_ip_forward_off was in 2009:

commit 92d385229be040cf034ac6efd9405b7bdfe06a3e
Author: Daniel Lezcano <dlezcano@fr.ibm.com>
Date:   Thu Oct 22 15:33:40 2009 +0200

    remove test directory

These functions are not called anymore.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
6 years agoMerge pull request #2092 from lifeng68/modify_console_create
Christian Brauner [Mon, 22 Jan 2018 09:40:15 +0000 (10:40 +0100)]
Merge pull request #2092 from lifeng68/modify_console_create

Create console when the rootfs is NULL

6 years agoFix comments and add check in lxc_poll.
LiFeng [Mon, 22 Jan 2018 11:13:52 +0000 (06:13 -0500)]
Fix comments and add check in lxc_poll.

Add check whether handler->conf->console.path is 'none'

Signed-off-by: LiFeng <lifeng68@huawei.com>
6 years agoMerge pull request #2100 from lifeng68/Modify_git_ignore
Christian Brauner [Mon, 22 Jan 2018 09:14:13 +0000 (10:14 +0100)]
Merge pull request #2100 from lifeng68/Modify_git_ignore

Modify .gitignore

6 years agoModify .gitignore
LiFeng [Mon, 22 Jan 2018 12:48:21 +0000 (07:48 -0500)]
Modify .gitignore

Add:
src/tests/lxc-test-api-reboot
src/tests/lxc-test-criu-check-feature
src/tests/lxc-test-raw-clone
src/tests/lxc-test-share-ns
src/tests/lxc-test-state-server

Signed-off-by: LiFeng <lifeng68@huawei.com>
6 years agoMerge pull request #2101 from tenforward/japanese
Christian Brauner [Mon, 22 Jan 2018 09:13:55 +0000 (10:13 +0100)]
Merge pull request #2101 from tenforward/japanese

doc: Update Japanese lxc-attach(1) and lxc.container.conf(5)

6 years agodoc: Update Japanese lxc-attach(1) and lxc.container.conf(5)
KATOH Yasufumi [Mon, 22 Jan 2018 05:47:48 +0000 (14:47 +0900)]
doc: Update Japanese lxc-attach(1) and lxc.container.conf(5)

* Update for commit ba2be1a (attach: move pty allocation into api)
* Update for commit 5757588 (manpage: correct lxc.log.file conf option)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
6 years agoattach: non-functional changes
Christian Brauner [Sun, 21 Jan 2018 14:23:20 +0000 (15:23 +0100)]
attach: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoattach: setup /proc limits
Christian Brauner [Sun, 21 Jan 2018 14:20:19 +0000 (15:20 +0100)]
attach: setup /proc limits

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostart: fix mainloop cleanup goto statements
Christian Brauner [Sun, 21 Jan 2018 12:55:42 +0000 (13:55 +0100)]
start: fix mainloop cleanup goto statements

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1426694
Christian Brauner [Sat, 20 Jan 2018 20:46:31 +0000 (21:46 +0100)]
coverity: #1426694

remove logically dead code

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1426734
Christian Brauner [Sat, 20 Jan 2018 20:44:50 +0000 (21:44 +0100)]
coverity: #1426734

do not call close on bad fd

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1427190
Christian Brauner [Mon, 8 Jan 2018 17:25:56 +0000 (18:25 +0100)]
coverity: #1427190

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1427191
Christian Brauner [Mon, 8 Jan 2018 17:24:41 +0000 (18:24 +0100)]
coverity: #1427191

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1427638
Christian Brauner [Sat, 20 Jan 2018 20:35:35 +0000 (21:35 +0100)]
coverity: #1427638

avoid (however unlikely) double free

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1427639
Christian Brauner [Sat, 20 Jan 2018 20:30:17 +0000 (21:30 +0100)]
coverity: #1427639

remove logically dead code

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1427668
Christian Brauner [Sat, 20 Jan 2018 20:26:33 +0000 (21:26 +0100)]
coverity: #1427668

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotools: fix android
Christian Brauner [Sat, 20 Jan 2018 13:05:01 +0000 (14:05 +0100)]
tools: fix android

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotools: non-functional changes
Christian Brauner [Sat, 20 Jan 2018 13:04:15 +0000 (14:04 +0100)]
tools: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoattach: init struct
Christian Brauner [Sat, 20 Jan 2018 11:57:12 +0000 (12:57 +0100)]
attach: init struct

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2097 from mikemccracken/2018-01-19/report-storage-destroy
Christian Brauner [Sat, 20 Jan 2018 05:27:36 +0000 (06:27 +0100)]
Merge pull request #2097 from mikemccracken/2018-01-19/report-storage-destroy

storage: treat return value from ops->destroy as int

6 years agoMerge pull request #2096 from mikemccracken/patch-1
Christian Brauner [Fri, 19 Jan 2018 23:42:16 +0000 (00:42 +0100)]
Merge pull request #2096 from mikemccracken/patch-1

manpage: correct lxc.log.file conf option

6 years agoMerge pull request #2095 from tych0/remove-lxc-init
Christian Brauner [Fri, 19 Jan 2018 17:49:21 +0000 (18:49 +0100)]
Merge pull request #2095 from tych0/remove-lxc-init

unlink lxc-init

6 years agostorage: treat return value from ops->destroy as int
Michael McCracken [Fri, 19 Jan 2018 16:38:36 +0000 (08:38 -0800)]
storage: treat return value from ops->destroy as int

r->ops->destroy() returns an int, -1 on error.
When assigned to a bool, this becomes true and hides errors.

Signed-off-by: Michael McCracken <mikmccra@cisco.com>
6 years agounlink lxc-init
Tycho Andersen [Wed, 20 Dec 2017 17:52:38 +0000 (17:52 +0000)]
unlink lxc-init

It's sort of an implementation detail that this exists at all, and we
should probably not pollute the container's mount tables or FS with this.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
6 years ago Adapt lxc_setup_console() to bind mount 'console'
LiFeng [Fri, 19 Jan 2018 16:23:35 +0000 (11:23 -0500)]
 Adapt lxc_setup_console() to bind mount 'console'

Signed-off-by: LiFeng <lifeng68@huawei.com>
6 years agomanpage: correct lxc.log.file conf option
Michael McCracken [Fri, 19 Jan 2018 19:05:26 +0000 (11:05 -0800)]
manpage: correct lxc.log.file conf option

lxc.log.file instead of just lxc.log

Signed-off-by: Michael McCracken <mikmccra@cisco.com>
6 years agoMerge pull request #2094 from tych0/propagate-exit-code
Serge Hallyn [Fri, 19 Jan 2018 04:26:32 +0000 (22:26 -0600)]
Merge pull request #2094 from tych0/propagate-exit-code

Propagate exit code for app containers

6 years agoset exit status to 1 in the unknown si_code case
Tycho Andersen [Fri, 19 Jan 2018 04:23:48 +0000 (04:23 +0000)]
set exit status to 1 in the unknown si_code case

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
6 years agolxc-execute: actually exit with the status of the spawned task
Tycho Andersen [Fri, 19 Jan 2018 03:31:33 +0000 (03:31 +0000)]
lxc-execute: actually exit with the status of the spawned task

Now that we have things propagated through init and liblxc correctly, at
least in non-daemon mode, we can exit with the actual exit status of the
task, instead of always succeeding, which is not so helpful.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
6 years agostart: don't return false when the container's init exits nonzero
Tycho Andersen [Fri, 19 Jan 2018 03:29:05 +0000 (03:29 +0000)]
start: don't return false when the container's init exits nonzero

This seems slightly counter-intuitive, but IMO it's what we want.
Basically, ->start() should succeed if the container is spawned correctly
(similar to how golang's exec.Cmd.Start() returns nil if the thing spawns
correctly), and users can check error_num (i.e. golang's exec.Cmd.Wait())
to see how it exited.

This preserves previous behavior, which basically was that start was always
successful if the thing actually launched. Since we never kept track of
exit codes, this would always succeed too. Now that we do, it doesn't, and
this change is required.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
6 years agoremember the exit code from the init process
Tycho Andersen [Fri, 19 Jan 2018 03:24:59 +0000 (03:24 +0000)]
remember the exit code from the init process

error_num seems to be trying to remember the exit code of the init process,
except that nothing actually keeps track of it anywhere. So, let's add a
field to the handler, so that we can keep track of the process' exit
status, and the propagate it to error_num in struct lxc_container so that
people can use it.

Note that this is a slight behavior change, essentially instead of making
error_num always == the return code from start, now it contains slightly
more useful information (the actual exit status). But, there is only one
internal user of error_num which I'll fix in later in the series, so IMO
this is ok.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
6 years agolxc.init: correctly exit with the app's error code
Tycho Andersen [Fri, 19 Jan 2018 03:21:10 +0000 (03:21 +0000)]
lxc.init: correctly exit with the app's error code

Based on the comments in the code (and the have_status flag), the intent
here (and IMO, the desired behavior) should be for init.lxc to propagate
the actual exit code from the real application process up through.
Otherwise, it is swallowed and nobody can access it.

The bug being fixed here is that ret held the correct exit code, but when
it went around the loop again (to wait for other children) ret is
clobbered. Let's save the desired exit status somewhere else, so it can't
get clobbered, and we propagate things correctly.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
6 years agofix lxc_error_set_and_log to match the docs
Tycho Andersen [Fri, 19 Jan 2018 03:20:08 +0000 (03:20 +0000)]
fix lxc_error_set_and_log to match the docs

The documentation for this function says if the task was killed by a
signal, the return code will be 128+n, where n is the signal number. Let's
make that actually true.

(We'll use this behavior in later patches.)

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
6 years agostart: don't log stop/continue for non-init processes
Tycho Andersen [Fri, 19 Jan 2018 00:50:39 +0000 (00:50 +0000)]
start: don't log stop/continue for non-init processes

This non-init forwarding check should really be before all the log messages
about "init continued" or "init stopped", since they will otherwise lie
about some process that wasn't init being stopped or continued.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
6 years agoCreate console when the rootfs is NULL
LiFeng [Thu, 18 Jan 2018 22:26:11 +0000 (17:26 -0500)]
Create console when the rootfs is NULL

Signed-off-by: LiFeng <lifeng68@huawei.com>
6 years agoMerge pull request #2089 from brauner/2018-01-17/restore_blocking_wait
Serge Hallyn [Wed, 17 Jan 2018 23:44:24 +0000 (17:44 -0600)]
Merge pull request #2089 from brauner/2018-01-17/restore_blocking_wait

lxccontainer: restore blocking wait()

6 years agocommands: add LXC_CMD_SERVE_STATE_CLIENTS
Christian Brauner [Wed, 17 Jan 2018 19:46:04 +0000 (20:46 +0100)]
commands: add LXC_CMD_SERVE_STATE_CLIENTS

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agofreezer: non-functional changes
Christian Brauner [Wed, 17 Jan 2018 19:09:13 +0000 (20:09 +0100)]
freezer: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolxccontainer: restore blocking wait()
Christian Brauner [Wed, 17 Jan 2018 14:22:36 +0000 (15:22 +0100)]
lxccontainer: restore blocking wait()

Closes #2027.
Closes lxc/go-lxc#98.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2061 from brauner/2017-12-23/attach_allocate_pty_in_api
Serge Hallyn [Wed, 17 Jan 2018 23:42:57 +0000 (17:42 -0600)]
Merge pull request #2061 from brauner/2017-12-23/attach_allocate_pty_in_api

attach: add LXC_ATTACH_ALLOCATE_PTY

6 years agoutils: check suffix length
Christian Brauner [Wed, 17 Jan 2018 11:21:09 +0000 (12:21 +0100)]
utils: check suffix length

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotest: log error on failure
Christian Brauner [Wed, 17 Jan 2018 10:50:54 +0000 (11:50 +0100)]
test: log error on failure

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoutils: do not rely on unitialized variable
Christian Brauner [Wed, 17 Jan 2018 10:19:05 +0000 (11:19 +0100)]
utils: do not rely on unitialized variable

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2086 from kunkku/alpine-ptrace
Christian Brauner [Tue, 16 Jan 2018 14:25:43 +0000 (15:25 +0100)]
Merge pull request #2086 from kunkku/alpine-ptrace

lxc-alpine: allow retaining sys_ptrace per container

6 years agolxc-alpine: allow retaining sys_ptrace per container
Kaarle Ritvanen [Tue, 16 Jan 2018 13:53:04 +0000 (15:53 +0200)]
lxc-alpine: allow retaining sys_ptrace per container

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
6 years agoMerge pull request #2085 from duguhaotian/master
Christian Brauner [Tue, 16 Jan 2018 09:50:11 +0000 (10:50 +0100)]
Merge pull request #2085 from duguhaotian/master

[console] return wrong console logsize

6 years ago[console] return wrong console logsize
duguhaotian [Tue, 16 Jan 2018 07:31:14 +0000 (15:31 +0800)]
[console] return wrong console logsize

get_config_console_logsize want console.buffer_size not c->autodev

Signed-off-by: duguhaotian <duguhaotian@gmail.com>
6 years agotests: do not call close() on invalid fd
Christian Brauner [Fri, 12 Jan 2018 17:26:40 +0000 (18:26 +0100)]
tests: do not call close() on invalid fd

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconsole: set SFD_CLOEXEC on signal fd
Christian Brauner [Sun, 31 Dec 2017 00:58:16 +0000 (01:58 +0100)]
console: set SFD_CLOEXEC on signal fd

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostart: non-functional changes
Christian Brauner [Sun, 31 Dec 2017 00:48:01 +0000 (01:48 +0100)]
start: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotools: honor --console and --console-log
Christian Brauner [Mon, 25 Dec 2017 00:52:33 +0000 (01:52 +0100)]
tools: honor --console and --console-log

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoattach: move pty allocation into api
Christian Brauner [Sun, 24 Dec 2017 18:25:34 +0000 (19:25 +0100)]
attach: move pty allocation into api

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoattach_options: add log_fd argument
Christian Brauner [Tue, 9 Jan 2018 11:27:05 +0000 (12:27 +0100)]
attach_options: add log_fd argument

This will be used to log the output of attach to.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoattach: minor tweaks
Christian Brauner [Sun, 24 Dec 2017 18:24:35 +0000 (19:24 +0100)]
attach: minor tweaks

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconsole: add lxc_pty_map_ids()
Christian Brauner [Sun, 24 Dec 2017 18:13:54 +0000 (19:13 +0100)]
console: add lxc_pty_map_ids()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconsole: adapt lxc_console_mainloop_add()
Christian Brauner [Sat, 23 Dec 2017 12:25:44 +0000 (13:25 +0100)]
console: adapt lxc_console_mainloop_add()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoattach: cleanup attach_child_main()
Christian Brauner [Sat, 23 Dec 2017 11:39:52 +0000 (12:39 +0100)]
attach: cleanup attach_child_main()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconsole: add some pty helpers
Christian Brauner [Sat, 23 Dec 2017 11:19:51 +0000 (12:19 +0100)]
console: add some pty helpers

- int lxc_make_controlling_pty()
- int lxc_login_pty()
- void lxc_pty_conf_free()
- void lxc_pty_info_init()
- void lxc_pty_init()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostart: non-functional changes
Christian Brauner [Sat, 23 Dec 2017 11:03:32 +0000 (12:03 +0100)]
start: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconf: move ringbuffer members to anonymous struct
Christian Brauner [Sat, 23 Dec 2017 11:02:45 +0000 (12:02 +0100)]
conf: move ringbuffer members to anonymous struct

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconsole: move pty creation to separate function
Christian Brauner [Sat, 23 Dec 2017 10:59:36 +0000 (11:59 +0100)]
console: move pty creation to separate function

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconfile: improve log messages
Christian Brauner [Tue, 9 Jan 2018 10:20:44 +0000 (11:20 +0100)]
confile: improve log messages

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2080 from tych0/add-idmap-parse-error-message
Christian Brauner [Tue, 9 Jan 2018 10:16:29 +0000 (11:16 +0100)]
Merge pull request #2080 from tych0/add-idmap-parse-error-message

add some idmap parsing error messages

6 years agoadd some idmap parsing error messages
Tycho Andersen [Tue, 9 Jan 2018 00:07:50 +0000 (00:07 +0000)]
add some idmap parsing error messages

otherwise, we just get a return value of false from setting config failure,
with no indication as to what actually failed in the log.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
6 years agoMerge pull request #2078 from tych0/usernsexec-exit-status
Christian Brauner [Mon, 8 Jan 2018 16:36:32 +0000 (17:36 +0100)]
Merge pull request #2078 from tych0/usernsexec-exit-status

fix up lxc-usernsexec's exit status

6 years agofix up lxc-usernsexec's exit status
Tycho Andersen [Mon, 8 Jan 2018 16:20:24 +0000 (16:20 +0000)]
fix up lxc-usernsexec's exit status

* exit(1) when there is an option parsing error
* exit(0) when the user explicitly asks for help
* exit(1) when the user specifies an invalid option

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
6 years agoMerge pull request #2077 from lifeng68/Fix_segment_fault
Christian Brauner [Mon, 8 Jan 2018 08:13:51 +0000 (09:13 +0100)]
Merge pull request #2077 from lifeng68/Fix_segment_fault

Add return check for 'lxc_cmd_get_name'

6 years agoAdd return check for 'lxc_cmd_get_name'
LiFeng [Mon, 8 Jan 2018 19:26:00 +0000 (14:26 -0500)]
Add return check for 'lxc_cmd_get_name'

If 'lxc_cmd_get_name' failed and return with NULL, this would cause a segment fault.

Signed-off-by: LiFeng <lifeng68@huawei.com>
6 years agoMerge pull request #2075 from stgraber/master
Christian Brauner [Sat, 6 Jan 2018 09:25:18 +0000 (10:25 +0100)]
Merge pull request #2075 from stgraber/master

lxc_get_version() should show the "-devel" suffix

6 years agoInclude -devel suffix in version string
Stéphane Graber [Fri, 5 Jan 2018 20:20:55 +0000 (15:20 -0500)]
Include -devel suffix in version string

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
6 years agoFix broken indentation
Stéphane Graber [Fri, 5 Jan 2018 20:19:30 +0000 (15:19 -0500)]
Fix broken indentation

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
6 years agoMerge pull request #2067 from brauner/2018-01-03/allow_fully_unprivileged_containers
Serge Hallyn [Thu, 4 Jan 2018 16:26:01 +0000 (10:26 -0600)]
Merge pull request #2067 from brauner/2018-01-03/allow_fully_unprivileged_containers

conf: write "deny" to /proc/[pid]/setgroups

6 years agoMerge pull request #2068 from brauner/2018-01-03/cleanup_command_after_revert
Serge Hallyn [Thu, 4 Jan 2018 16:21:17 +0000 (10:21 -0600)]
Merge pull request #2068 from brauner/2018-01-03/cleanup_command_after_revert

commands: fully revert set_running_config_item()

6 years agocgfsng: only establish mapping once
Christian Brauner [Thu, 4 Jan 2018 14:28:12 +0000 (15:28 +0100)]
cgfsng: only establish mapping once

When we deleted cgroups for unprivileged containers we used to allocate a new
mapping and clone a new user namespace each time we delete a cgroup. This of
course meant - on a cgroup v1 system - doing this >= 10 times when all
controllers were used. Let's not to do this and only allocate and establish a
mapping once.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconf: rework userns_exec_1()
Christian Brauner [Thu, 4 Jan 2018 14:01:06 +0000 (15:01 +0100)]
conf: rework userns_exec_1()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconf: non-functional changes
Christian Brauner [Thu, 4 Jan 2018 13:59:42 +0000 (14:59 +0100)]
conf: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconf: write "deny" to /proc/[pid]/setgroups
Christian Brauner [Wed, 3 Jan 2018 15:28:40 +0000 (16:28 +0100)]
conf: write "deny" to /proc/[pid]/setgroups

When fully unprivileged users run a container that only maps their own {g,u}id
and they do not have access to setuid new{g,u}idmap binaries we will write the
idmapping directly. This however requires us to write "deny" to
/proc/[pid]/setgroups otherwise any write to /proc/[pid]/gid_map will be
denied.

On a sidenote, this patch enables fully unprivileged containers. If you now set
lxc.net.[i].type = empty no privilege whatsoever is required to run a container.

Enhances #2033.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Felix Abecassis <fabecassis@nvidia.com>
Cc: Jonathan Calmels <jcalmels@nvidia.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2069 from stgraber/master
Christian Brauner [Thu, 4 Jan 2018 09:29:43 +0000 (10:29 +0100)]
Merge pull request #2069 from stgraber/master

gentoo: Add support for .xz tarballs

6 years agoMerge pull request #2070 from hallyn/2018-01-03/staticlibcap
Christian Brauner [Thu, 4 Jan 2018 09:29:18 +0000 (10:29 +0100)]
Merge pull request #2070 from hallyn/2018-01-03/staticlibcap

configure.ac: fix the check for static libcap

6 years agoconfigure.ac: fix the check for static libcap
Serge Hallyn [Thu, 4 Jan 2018 03:02:53 +0000 (21:02 -0600)]
configure.ac: fix the check for static libcap

The existing check doesn't work, because when you statically
link a program against libc, any functions not called are not
included.  So cap_init() which we check for is not there in
the built binary.

So instead just check whether a "gcc -lcap -static" works.
If libcap.a is not available it will fail, if it is it will
succeed.

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
6 years agogentoo: Add support for .xz tarballs
Stéphane Graber [Wed, 3 Jan 2018 23:06:33 +0000 (18:06 -0500)]
gentoo: Add support for .xz tarballs

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
6 years agocommands: fully revert set_running_config_item()
Christian Brauner [Wed, 3 Jan 2018 17:28:58 +0000 (18:28 +0100)]
commands: fully revert set_running_config_item()

The noop implementation is pointless.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2065 from brauner/2017-01-01/revert_set_running_config_item
Stéphane Graber [Wed, 3 Jan 2018 17:12:39 +0000 (12:12 -0500)]
Merge pull request #2065 from brauner/2017-01-01/revert_set_running_config_item

lxccontainer: revert set_running_config_item()

6 years agoMerge pull request #2066 from brauner/2017-01-02/support_no_root_mappings
Serge Hallyn [Wed, 3 Jan 2018 03:42:06 +0000 (21:42 -0600)]
Merge pull request #2066 from brauner/2017-01-02/support_no_root_mappings

Support configurations without root mapping

6 years agoconf: detect if devpts can be mounted with gid=5
Christian Brauner [Tue, 2 Jan 2018 23:11:38 +0000 (00:11 +0100)]
conf: detect if devpts can be mounted with gid=5

Closes #2033.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgfsng: use init {g,u}id
Christian Brauner [Tue, 2 Jan 2018 22:41:10 +0000 (23:41 +0100)]
cgfsng: use init {g,u}id

If no id mapping for the container's root id is defined try to us the id
mappings specified via lxc.init.{g,u}id.

Closes #2033.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconf{ile}: detect ns{g,u}id mapping for root
Christian Brauner [Tue, 2 Jan 2018 22:27:55 +0000 (23:27 +0100)]
conf{ile}: detect ns{g,u}id mapping for root

Closes #2033.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconf: adapt userns_exec_1()
Christian Brauner [Tue, 2 Jan 2018 21:31:16 +0000 (22:31 +0100)]
conf: adapt userns_exec_1()

Closes #2033.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconf: adapt idmap helpers
Christian Brauner [Tue, 2 Jan 2018 21:15:17 +0000 (22:15 +0100)]
conf: adapt idmap helpers

- mapped_hostid_entry()
- idmap_add()

Closes #2033.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolxccontainer: revert set_running_config_item()
Christian Brauner [Mon, 1 Jan 2018 20:56:23 +0000 (21:56 +0100)]
lxccontainer: revert set_running_config_item()

- As discussed we will have a proper API extension that will allow updating
  various parts of a running container. The prior approach wasn't a good idea.

- Revert this is not a problem since we haven't released any version with the
  set_running_config_item() API extension.

- I'm not simply reverting so that master users can still call into new
  liblxc's without crashing the container. This is achieved by keeping the
  commands callback struct member number identical.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2062 from brauner/2017-12-25/capture_output_of_short_lived_init_p...
Serge Hallyn [Sat, 30 Dec 2017 23:27:48 +0000 (17:27 -0600)]
Merge pull request #2062 from brauner/2017-12-25/capture_output_of_short_lived_init_process

mainloop: capture output of short-lived init procs

6 years agomainloop: use epoll_create1(EPOLL_CLOEXEC)
Christian Brauner [Tue, 26 Dec 2017 19:57:12 +0000 (20:57 +0100)]
mainloop: use epoll_create1(EPOLL_CLOEXEC)

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>