]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
7 years agocoverity: #1425883
Christian Brauner [Sat, 9 Dec 2017 17:54:28 +0000 (18:54 +0100)] 
coverity: #1425883

ensure \0-termination

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocoverity: #1425884
Christian Brauner [Sat, 9 Dec 2017 17:46:56 +0000 (18:46 +0100)] 
coverity: #1425884

free allocated memory

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocoverity: #1428855
Christian Brauner [Sat, 9 Dec 2017 17:45:47 +0000 (18:45 +0100)] 
coverity: #1428855

remove logically dead code

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocoverity: #1425886
Christian Brauner [Sat, 9 Dec 2017 17:44:41 +0000 (18:44 +0100)] 
coverity: #1425886

free allocated memory

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocoverity: #1425893
Christian Brauner [Sat, 9 Dec 2017 17:35:33 +0000 (18:35 +0100)] 
coverity: #1425893

used calculated string length when copying into buffer

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agotravis: Fix build failure
Stéphane Graber [Sat, 9 Dec 2017 06:50:37 +0000 (01:50 -0500)] 
travis: Fix build failure

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
7 years agolxc: Distinguish pthread_mutex_unlock error messages
Marcos Paulo de Souza [Fri, 8 Dec 2017 02:02:18 +0000 (00:02 -0200)] 
lxc: Distinguish pthread_mutex_unlock error messages

The same message exists in lxclock.c and cgmanager.c, so print the
filename along with the message.

Before this patch:
lxc-destroy -n u1
pthread_mutex_unlock returned:1 Operation not permitted

After this patch:
xc-destroy -n u1
lxclock.c: pthread_mutex_unlock returned:1 Operation not permitted

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
7 years agocoverity: #1425888
Christian Brauner [Thu, 7 Dec 2017 14:24:28 +0000 (15:24 +0100)] 
coverity: #1425888

check return value of getifaddrs()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocoverity: #1425889
Christian Brauner [Thu, 7 Dec 2017 14:21:57 +0000 (15:21 +0100)] 
coverity: #1425889

do not call close on bad file descriptor

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocoverity: #1425890
Christian Brauner [Thu, 7 Dec 2017 14:18:35 +0000 (15:18 +0100)] 
coverity: #1425890

silence complaint about unchecked return value from library function

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocoverity: #1425895
Christian Brauner [Thu, 7 Dec 2017 14:17:11 +0000 (15:17 +0100)] 
coverity: #1425895

free allocated memory

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocoverity: #1425921
Christian Brauner [Thu, 7 Dec 2017 14:14:37 +0000 (15:14 +0100)] 
coverity: #1425921

free allocated memory

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocoverity: #1425922
Christian Brauner [Thu, 7 Dec 2017 14:11:16 +0000 (15:11 +0100)] 
coverity: #1425922

free allocated memory

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocoverity: #1425923
Christian Brauner [Thu, 7 Dec 2017 14:09:46 +0000 (15:09 +0100)] 
coverity: #1425923

avoid NULL-pointer dereference

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocoverity: #1425929
Christian Brauner [Thu, 7 Dec 2017 13:59:55 +0000 (14:59 +0100)] 
coverity: #1425929

free allocated memory

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocoverity: #1425739
Christian Brauner [Wed, 6 Dec 2017 20:38:14 +0000 (21:38 +0100)] 
coverity: #1425739

check snprintf() return value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocoverity: #1425735
Christian Brauner [Wed, 6 Dec 2017 20:22:03 +0000 (21:22 +0100)] 
coverity: #1425735

use correct inequality comparison

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocoverity: #1425734
Christian Brauner [Wed, 6 Dec 2017 20:16:38 +0000 (21:16 +0100)] 
coverity: #1425734

free memory on error

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agotests: expand tests for shortlived init processes
Christian Brauner [Wed, 6 Dec 2017 14:56:35 +0000 (15:56 +0100)] 
tests: expand tests for shortlived init processes

This adds additional test for app containers.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolxc_init: add custom argument parser
RicardoSanchezA [Wed, 6 Dec 2017 15:30:44 +0000 (09:30 -0600)] 
lxc_init: add custom argument parser

lxc_init.c should not depend on tools/arguments.{c,h}, thus it needs its own custom argument parser

Signed-off-by: RicardoSanchezA <ricardo.sanchez@utexas.edu>
7 years agoinit: rework dumb init
Christian Brauner [Tue, 10 Oct 2017 14:53:25 +0000 (16:53 +0200)] 
init: rework dumb init

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolxc_init: move up to src/lxc
RicardoSanchezA [Wed, 6 Dec 2017 15:28:19 +0000 (09:28 -0600)] 
lxc_init: move up to src/lxc

lxc_init.c is actually not a tool, thus it doesn't belong to the tools/ subfolder

Signed-off-by: RicardoSanchezA <ricardo.sanchez@utexas.edu>
7 years agolxccontainer: handle execute containers correctly
Christian Brauner [Wed, 6 Dec 2017 14:37:40 +0000 (15:37 +0100)] 
lxccontainer: handle execute containers correctly

It doesn't make sense to error out when an app container doesn't pass explicit
arguments through c->start{l}(). This is especially true since we implemented
lxc.execute.cmd. However, even before we could have always relied on
lxc.init.cmd and errored out after that.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoexecute: pass logfile to lxc-init
Christian Brauner [Wed, 6 Dec 2017 14:37:12 +0000 (15:37 +0100)] 
execute: pass logfile to lxc-init

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocommands: return -ECONNRESET to caller
Christian Brauner [Wed, 6 Dec 2017 14:33:23 +0000 (15:33 +0100)] 
commands: return -ECONNRESET to caller

Callers can then make a decision whether they want to consider the peer closing
the connection an error or not. For example, a c->wait(c, "STOPPED", -1) call
can then consider a ECONNRESET not an error but rather see it - correctly - as
a container exiting before being able to register a state client.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocommands: tell mainloop to reap client fd on error
Christian Brauner [Sat, 25 Nov 2017 16:51:01 +0000 (17:51 +0100)] 
commands: tell mainloop to reap client fd on error

This is the proper way to handle errors.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolxccontainer: restore non-blocking shutdown
Christian Brauner [Fri, 24 Nov 2017 22:19:34 +0000 (23:19 +0100)] 
lxccontainer: restore non-blocking shutdown

If timeout is set to 0 don't block.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocommands: tweak locking
Christian Brauner [Fri, 24 Nov 2017 11:51:04 +0000 (12:51 +0100)] 
commands: tweak locking

Take the lock on the list after we've done all necessary work and check state.
If we are in requested state, do cleanup and return without adding the state
client to the state client list.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agotest: add state server tests
Christian Brauner [Wed, 22 Nov 2017 20:32:07 +0000 (21:32 +0100)] 
test: add state server tests

This checks whether multiple concurrent waiters all get notified by the state
server.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocommands: allow waiting for all states
Christian Brauner [Tue, 21 Nov 2017 19:42:28 +0000 (20:42 +0100)] 
commands: allow waiting for all states

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agostart: don't lock setting the state
Christian Brauner [Wed, 22 Nov 2017 13:32:56 +0000 (14:32 +0100)] 
start: don't lock setting the state

- setting the handler->state value is atomic on any POSIX implementation since
  we're dealing with an integer (enum/lxc_state_t)
- while the state clients are served it is not possible for lxc_set_state() to
  transition to the next state anyway so there's no danger in moving to the
  next state with clients missing it
- we only care about the list being modified

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocommands: don't lock the whole command
Christian Brauner [Wed, 22 Nov 2017 13:29:32 +0000 (14:29 +0100)] 
commands: don't lock the whole command

There are multiple reasons why this is not required:
- every command is transactional
- we only care about the list being modified not the memory allocation and
  other costly operations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocommands: don't lock atomic operations
Christian Brauner [Wed, 22 Nov 2017 13:25:10 +0000 (14:25 +0100)] 
commands: don't lock atomic operations

We're dealing with an integer (lxc_state_t which is an enum). Any POSIX
implementation makes those operations atomic so there's not need in locking
this.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocommands: don't traverse whole list
Christian Brauner [Wed, 22 Nov 2017 13:13:07 +0000 (14:13 +0100)] 
commands: don't traverse whole list

When we remove a state client fd there's not reason to walk the whole list. We
can simply break once we found and removed the fd.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agostart: set loglevel correctly
Christian Brauner [Tue, 5 Dec 2017 23:16:38 +0000 (00:16 +0100)] 
start: set loglevel correctly

We want the loglevel that the user specified when starting the container
because it overrides the default one set in the config.

Closes #2003.

Reported-by: Felix Abecassis <fabecassis@nvidia.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoarguments: move to tools/ subdirectory
RicardoSanchezA [Tue, 5 Dec 2017 04:03:52 +0000 (22:03 -0600)] 
arguments: move to tools/ subdirectory

The arguments.{c,h} file should not be a part of liblxc itself. It should only
be used for the lxc tools.

Signed-off-by: RicardoSanchezA <ricardo.sanchez@utexas.edu>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolxc_execute: properly figure out number of needed arguments
Serge Hallyn [Tue, 5 Dec 2017 04:30:26 +0000 (22:30 -0600)] 
lxc_execute: properly figure out number of needed arguments

The lxc_log args have noghing to do with lxc.rootfs.path, and
we need room for a NULL at end of arguments.

How this bug was hidden for so long I don't know - I can only
trigger it on certain systems under certain conditions, but it's
definately wrong as is.

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
7 years agotest: reenable Coverity integration
Christian Brauner [Mon, 4 Dec 2017 22:41:45 +0000 (23:41 +0100)] 
test: reenable Coverity integration

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoattach: do not fail on non-existing namespaces
Christian Brauner [Mon, 4 Dec 2017 11:26:55 +0000 (12:26 +0100)] 
attach: do not fail on non-existing namespaces

Closes #1993.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocriu: silence static analysis
Christian Brauner [Mon, 4 Dec 2017 00:48:46 +0000 (01:48 +0100)] 
criu: silence static analysis

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconfile: remove dead assignment
Christian Brauner [Mon, 4 Dec 2017 00:44:45 +0000 (01:44 +0100)] 
confile: remove dead assignment

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocriu: initialize status
Christian Brauner [Mon, 4 Dec 2017 00:41:49 +0000 (01:41 +0100)] 
criu: initialize status

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconf: prevent null pointer dereference
Christian Brauner [Mon, 4 Dec 2017 00:34:50 +0000 (01:34 +0100)] 
conf: prevent null pointer dereference

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoInsert missing "echo" after "is_enabled"
Pierre LALET [Sun, 3 Dec 2017 11:32:39 +0000 (12:32 +0100)] 
Insert missing "echo" after "is_enabled"

Signed-off-by: Pierre LALET <pierre.lalet@cea.fr>
7 years agoFix SETCOLOR_FAILURE evaluation
Pierre LALET [Sun, 3 Dec 2017 10:28:07 +0000 (11:28 +0100)] 
Fix SETCOLOR_FAILURE evaluation

Signed-off-by: Pierre LALET <pierre.lalet@cea.fr>
7 years agoAdd bash completion to list backing store types for lxc-create -B
Abbas Ally [Sun, 3 Dec 2017 05:51:44 +0000 (05:51 +0000)] 
Add bash completion to list backing store types for lxc-create -B
- Backing Store types are hard-coded (Not sure how to get programmatically)
- Closes #1236

Signed-off-by: Abbas Ally <abbasally5@yahoo.com>
7 years agoAdd new dependency to Slackware template
CC-Hsu [Sat, 2 Dec 2017 11:27:34 +0000 (19:27 +0800)] 
Add new dependency to Slackware template

I followed the [changelog of Slackware-current]<http://www.slackware.com/changelog/>,
and found that Slackware-current split hostname utility from util-linux package in Nov 17 2017.
So I add the new package to the template.

Signed-off-by: Chia-Chun Hsu <a12321aabb@gmail.com>
7 years agoUpdate gentoo.moresecure.conf.
i.Dark_Templar [Sat, 2 Dec 2017 07:33:51 +0000 (10:33 +0300)] 
Update gentoo.moresecure.conf.

Closes https://github.com/lxc/lxc/issues/1928

Signed-off-by: i.Dark_Templar <darktemplar@dark-templar-archives.net>
7 years agolxc_unshare: Add uid_mapping when creating userns
Marcos Paulo de Souza [Wed, 29 Nov 2017 01:49:28 +0000 (23:49 -0200)] 
lxc_unshare: Add uid_mapping when creating userns

Change conf.c to export function write_id_mapping, which will now be
called inside main function of lxc_unshare.c.

This is required because setuid syscalls only permits a new userns to
set a new uid if the uid of parameter is mapped inside the ns using
uid_map file[1]. So, just after the clone invocation, map the uid passed as
parameter into the newly created user namespace, and put the current uid
as the ID-outside-ns. After the mapping is done, setuid call succeeds.

Closes: #494
[1] https://elixir.free-electrons.com/linux/latest/source/kernel/user_namespace.c#L286

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
7 years agoutils: declare sethostname() static inline
Christian Brauner [Fri, 1 Dec 2017 22:18:09 +0000 (23:18 +0100)] 
utils: declare sethostname() static inline

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconfile: fix memory leak
Felix Abecassis [Wed, 29 Nov 2017 04:27:28 +0000 (20:27 -0800)] 
confile: fix memory leak

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
7 years agotools/lxc_wait: removed internal logging
AustinReichert [Tue, 28 Nov 2017 23:55:53 +0000 (17:55 -0600)] 
tools/lxc_wait: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
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>
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 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 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 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 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 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 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>