]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
6 years agostart: do not unconditionally dup std{in,out,err}
Christian Brauner [Tue, 12 Dec 2017 19:09:06 +0000 (20:09 +0100)]
start: do not unconditionally dup std{in,out,err}

Starting with commit

    commit c5b93afba1d79c6861a6f45db2943b6f3cfbdab4
    Author: Li Feng <lifeng68@huawei.com>
    Date:   Mon Jul 10 17:19:52 2017 +0800

        start: dup std{in,out,err} to pty slave

        In the case the container has a console with a valid slave pty file descriptor
        we duplicate std{in,out,err} to the slave file descriptor so console logging
        works correctly. When the container does not have a valid slave pty file
        descriptor for its console and is started daemonized we should dup to
        /dev/null.

        Closes #1646.

Signed-off-by: Li Feng <lifeng68@huawei.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
we made std{err,in,out} a duplicate of the slave file descriptor of the console
if it existed. This meant we also duplicated all of them when we executed
application containers in the foreground even if some std{err,in,out} file
descriptor did not refer to a {p,t}ty. This blocked use cases such as:

    echo foo | lxc-execute -n -- cat

which are very valid and common with application containers but less common
with system containers where we don't have to care about this. So my suggestion
is to unconditionally duplicate std{err,in,out} to the console file descriptor
if we are either running daemonized - this ensures that daemonized application
containers with a single bash shell keep on working - or when we are not
running an application container. In other cases we only duplicate those file
descriptors that actually refer to a {p,t}ty. This logic is similar to what we
do for lxc-attach already.

Refers to #1690.
Closes #2028.

Reported-by: Felix Abecassis <fabecassis@nvidia.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2020 from brauner/2017-12-11/clone
Serge Hallyn [Mon, 11 Dec 2017 19:52:05 +0000 (13:52 -0600)]
Merge pull request #2020 from brauner/2017-12-11/clone

start: intelligently use clone() on ns sharing

6 years agotests: add namespace sharing tests
Christian Brauner [Mon, 11 Dec 2017 13:47:24 +0000 (14:47 +0100)]
tests: add namespace sharing tests

This also ensures that the new more efficient clone() way of sharing namespaces
is tested.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostart: intelligently use clone() on ns sharing
Christian Brauner [Mon, 11 Dec 2017 11:55:23 +0000 (12:55 +0100)]
start: intelligently use clone() on ns sharing

When I first solved this problem I went for a fork() + setns() + clone() model.
This works fine but has unnecessary overhead for a couple of reasons:

- doing a full fork() including copying file descriptor table and virtual
  memory
- using pipes to retrieve the pid of the second child (the actual container
  process)

This can all be avoided by being a little smart in how we employ the clone()
syscall:

- using CLONE_VM will let us get rid of using pipes since we can simply write
  to the handler because we share the memory with our parent
- using CLONE_VFORK will also let us get rid of using pipes since the execution
  of the parent is suspended until the child returns
- using CLONE_VM will not cause virtual memory to be copied
- using CLONE_FILES will not cause the file descriptor table to be copied

Note that the intermediate clone() is used with CLONE_VM. Some glibc versions
used to reset the pid/tid to -1 when CLONE_VM was used without CLONE_THREAD.
But since the memory between parent and child is shared on CLONE_VM this would
invalidate the getpid() cache that glibc used to maintain and so getpid() in
the child would return the parent's pid. This is all fixed in newer glibc
versions where the getpid() cache is removed and the pid/tid is not reset
anymore. However, if for whatever reason you - dear commiter - somehow need to
get the pid of the dummy intermediate process for do_share_ns() you need to
call syscall(__NR_getpid) directly. The next lxc_clone() call does not employ
CLONE_VM and will be fine.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconf: lxc.sysctl coding style fixes
Christian Brauner [Mon, 11 Dec 2017 10:27:24 +0000 (11:27 +0100)]
conf: lxc.sysctl coding style fixes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2009 from lifeng68/add_sysctl
Christian Brauner [Mon, 11 Dec 2017 10:21:07 +0000 (11:21 +0100)]
Merge pull request #2009 from lifeng68/add_sysctl

confile: add lxc.sysctl config

6 years agoconfile: Add lxc.sysctl config
LiFeng [Thu, 7 Dec 2017 16:40:35 +0000 (11:40 -0500)]
confile: Add lxc.sysctl config

Signed-off-by: LiFeng <lifeng68@huawei.com>
6 years agoMerge pull request #2019 from brauner/2017-12-11/fix_legacy_network_parser
Stéphane Graber [Mon, 11 Dec 2017 05:40:27 +0000 (00:40 -0500)]
Merge pull request #2019 from brauner/2017-12-11/fix_legacy_network_parser

legacy confile: fix legacy network parser

6 years agoconf: fix lxc.prlimit clearing
Christian Brauner [Mon, 11 Dec 2017 05:22:56 +0000 (06:22 +0100)]
conf: fix lxc.prlimit clearing

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolegacy confile: fix legacy network parser
Christian Brauner [Mon, 11 Dec 2017 05:03:45 +0000 (06:03 +0100)]
legacy confile: fix legacy network parser

This fixes a bug introduced by:

commit 94f0035bf636ba853451d59c129e26d94850c04d
Author: Christian Brauner <christian.brauner@ubuntu.com>
Date:   Thu Dec 7 15:07:26 2017 +0100

    coverity: #1425924

    remove logically dead condition

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Coverity's bug analysis is correct but my fix wasn't.

This commit fixes a bunch of other bugs I just spotted as well.

This unblocks #2009.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 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>
6 years agoMerge pull request #2016 from flx42/lxc-oci-misc-improvements
Serge Hallyn [Sat, 9 Dec 2017 04:56:14 +0000 (22:56 -0600)]
Merge pull request #2016 from flx42/lxc-oci-misc-improvements

lxc-oci misc improvements

6 years agolxc-oci: add support for WorkingDir
Felix Abecassis [Sat, 9 Dec 2017 01:13:01 +0000 (17:13 -0800)]
lxc-oci: add support for WorkingDir

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
6 years agoMerge pull request #2012 from marcosps/pthread_mtx_msg
Serge Hallyn [Sat, 9 Dec 2017 04:10:50 +0000 (22:10 -0600)]
Merge pull request #2012 from marcosps/pthread_mtx_msg

lxc: Distinguish pthread_mutex_unlock error messages

6 years agoMerge pull request #1950 from brauner/2017-11-27/criu_fixes
Serge Hallyn [Sat, 9 Dec 2017 03:59:09 +0000 (21:59 -0600)]
Merge pull request #1950 from brauner/2017-11-27/criu_fixes

bugfixes

6 years agolxc-oci: add IPv6 support to /etc/hosts
Felix Abecassis [Sat, 9 Dec 2017 00:58:41 +0000 (16:58 -0800)]
lxc-oci: add IPv6 support to /etc/hosts

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
6 years agolxc-oci: add basic handling of numerical uid/gid
Felix Abecassis [Sat, 9 Dec 2017 00:58:08 +0000 (16:58 -0800)]
lxc-oci: add basic handling of numerical uid/gid

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
6 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>
6 years agoMerge pull request #2011 from brauner/generic/coverity
Serge Hallyn [Thu, 7 Dec 2017 20:46:09 +0000 (14:46 -0600)]
Merge pull request #2011 from brauner/generic/coverity

coverity: bugfixes

6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 years agocoverity: #1425924
Christian Brauner [Thu, 7 Dec 2017 14:07:26 +0000 (15:07 +0100)]
coverity: #1425924

remove logically dead condition

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

Avoid NULL-pointer dereference. Apparently monitor.{c,h} calls
lxc_check_inherited() with NULL passed for the config. This isn't really a big
issue since monitor.{c,h} is effectively dead for all liblxc versions that have
the state client patch. Also, the patch that introduces the relevant lines into
lxc_check_inherited() is only in master and yet unreleased.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 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>
6 years agoMerge pull request #2007 from brauner/2017-12-06/bugfixes
Stéphane Graber [Wed, 6 Dec 2017 22:32:22 +0000 (17:32 -0500)]
Merge pull request #2007 from brauner/2017-12-06/bugfixes

coverity: bugfixes

6 years agoMerge pull request #1934 from brauner/2017-11-21/implement_do_lxc_reboot_correctly
Serge Hallyn [Wed, 6 Dec 2017 22:31:50 +0000 (16:31 -0600)]
Merge pull request #1934 from brauner/2017-11-21/implement_do_lxc_reboot_correctly

commands: improve and simplify locking + lxccontainer: add reboot2() API extension

6 years agocoverity: #1425743
Christian Brauner [Wed, 6 Dec 2017 20:57:55 +0000 (21:57 +0100)]
coverity: #1425743

remove logically dead code

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

fix error condition check

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

free allocated memory

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 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>
6 years agocoverity: #1425737
Christian Brauner [Wed, 6 Dec 2017 20:30:42 +0000 (21:30 +0100)]
coverity: #1425737

free allocated memory

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 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>
6 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>
6 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>
6 years agoMerge pull request #2006 from Ricardo-Yoshi-LXC/master
Christian Brauner [Wed, 6 Dec 2017 17:43:09 +0000 (18:43 +0100)]
Merge pull request #2006 from Ricardo-Yoshi-LXC/master

Move lxc_init up to lxc/src and add argument parser

6 years agolxc_init: changed minor details
RicardoSanchezA [Wed, 6 Dec 2017 17:01:04 +0000 (11:01 -0600)]
lxc_init: changed minor details

Signed-off-by: RicardoSanchezA <ricardo.sanchez@utexas.edu>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 years agotest: add test for reboot2() API extension
Christian Brauner [Tue, 21 Nov 2017 20:48:30 +0000 (21:48 +0100)]
test: add test for reboot2() API extension

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolxccontainer: add reboot2() API extension
Christian Brauner [Tue, 21 Nov 2017 20:29:57 +0000 (21:29 +0100)]
lxccontainer: add reboot2() API extension

This adds reboot2() as a new API extension. This function properly wait until a
reboot succeeded. It takes a timeout argument. When set to > 0 reboot2() will
block until the timeout is reached, if timeout is set to zero reboot2() will
not block, if set to -1 reboot2() will block indefinitly.

The struct state_client gets rename to lxc_state_client since it's more in line
with other declarations. It also gets moved from the lxc_handler to the
lxc_conf struct so that the state clients waiting for reboots don't get
deallocated on reboot since the handler is deallocated on reboot.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 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>
6 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>
6 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>
6 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>
6 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>
6 years agoMerge pull request #1994 from brauner/2017-12-04/bugfixes
Stéphane Graber [Wed, 6 Dec 2017 07:02:59 +0000 (23:02 -0800)]
Merge pull request #1994 from brauner/2017-12-04/bugfixes

attach: do not fail on non-existing namespaces

6 years agoMerge pull request #1996 from brauner/2017-12-04/reenable_coverity_scan
Stéphane Graber [Wed, 6 Dec 2017 07:01:11 +0000 (23:01 -0800)]
Merge pull request #1996 from brauner/2017-12-04/reenable_coverity_scan

test: Coverity scan integration

6 years agoMerge pull request #2004 from brauner/2017-12-06/fix_log_env_variable
Stéphane Graber [Wed, 6 Dec 2017 06:59:38 +0000 (22:59 -0800)]
Merge pull request #2004 from brauner/2017-12-06/fix_log_env_variable

start: set loglevel correctly

6 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>
6 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>
6 years agoMerge pull request #2002 from tenforward/japanese
Christian Brauner [Tue, 5 Dec 2017 10:55:58 +0000 (11:55 +0100)]
Merge pull request #2002 from tenforward/japanese

Add lxc.console.*, lxc.namespace.*, and lxc.init.cwd to Japanese lxc.container.conf(5)

6 years agodoc: Add lxc.init.cwd to Japanese lxc.container.conf(5)
KATOH Yasufumi [Tue, 5 Dec 2017 08:23:29 +0000 (17:23 +0900)]
doc: Add lxc.init.cwd to Japanese lxc.container.conf(5)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
6 years agodoc: Add lxc.namespace.[namespace identifier] to Japanese lxc.container.conf(5)
KATOH Yasufumi [Tue, 5 Dec 2017 08:08:52 +0000 (17:08 +0900)]
doc: Add lxc.namespace.[namespace identifier] to Japanese lxc.container.conf(5)

and fix the description of namespace inheritance

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
6 years agodoc: Add lxc.console.buffer.* and lxc.console.rotate to Japanese lxc.container.conf(5)
KATOH Yasufumi [Tue, 5 Dec 2017 07:22:37 +0000 (16:22 +0900)]
doc: Add lxc.console.buffer.* and lxc.console.rotate to Japanese lxc.container.conf(5)

and update the description of lxc.console.logfile

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
6 years agoMerge pull request #1992 from lifeng68/add_init_cwd
Christian Brauner [Tue, 5 Dec 2017 04:53:23 +0000 (05:53 +0100)]
Merge pull request #1992 from lifeng68/add_init_cwd

confile:add lxc.init.cwd

6 years agoconfile:add lxc.init.cwd
LiFeng [Mon, 4 Dec 2017 17:12:40 +0000 (12:12 -0500)]
confile:add lxc.init.cwd

Signed-off-by: LiFeng <lifeng68@huawei.com>
6 years agoMerge pull request #2000 from hallyn/2017-12-04/execargs
Christian Brauner [Tue, 5 Dec 2017 04:50:47 +0000 (05:50 +0100)]
Merge pull request #2000 from hallyn/2017-12-04/execargs

lxc_execute: properly figure out number of needed arguments

6 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>
6 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>
6 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>
6 years agoMerge pull request #1979 from marcosps/issue_494
Christian Brauner [Mon, 4 Dec 2017 11:10:22 +0000 (12:10 +0100)]
Merge pull request #1979 from marcosps/issue_494

lxc_unshare: Add uid_mapping when creating userns

6 years agoMerge pull request #1988 from abbasally5/feature-improve-bash-completion-1236
Stéphane Graber [Mon, 4 Dec 2017 07:57:43 +0000 (23:57 -0800)]
Merge pull request #1988 from abbasally5/feature-improve-bash-completion-1236

Add bash completion to list backing store types for lxc-create -B

6 years agoMerge pull request #1989 from p-l-/fix-lxc-checkconfig
Stéphane Graber [Mon, 4 Dec 2017 07:57:19 +0000 (23:57 -0800)]
Merge pull request #1989 from p-l-/fix-lxc-checkconfig

Fix lxc-checkconfig output

6 years agoMerge pull request #1981 from brauner/2017-12-01/fix_android_sethostname
Stéphane Graber [Mon, 4 Dec 2017 07:56:07 +0000 (23:56 -0800)]
Merge pull request #1981 from brauner/2017-12-01/fix_android_sethostname

utils: declare sethostname() static inline

6 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>
6 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>
6 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>
6 years agoconfile_legacy: prevent null pointer deref
Christian Brauner [Mon, 4 Dec 2017 00:38:01 +0000 (01:38 +0100)]
confile_legacy: prevent null pointer deref

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 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>
6 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>
6 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>
6 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>
6 years agoMerge pull request #1984 from CC-Hsu/patch-1
Christian Brauner [Sat, 2 Dec 2017 12:00:36 +0000 (13:00 +0100)]
Merge pull request #1984 from CC-Hsu/patch-1

Add new dependency to Slackware template

6 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>
6 years agoMerge pull request #1983 from iDarkTemplar/update_template
Christian Brauner [Sat, 2 Dec 2017 08:10:56 +0000 (09:10 +0100)]
Merge pull request #1983 from iDarkTemplar/update_template

Update gentoo.moresecure.conf.

6 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>
6 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>
6 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>
6 years agoMerge pull request #1980 from flx42/lxc-oci-layer-caching
Serge Hallyn [Fri, 1 Dec 2017 19:50:11 +0000 (13:50 -0600)]
Merge pull request #1980 from flx42/lxc-oci-layer-caching

OCI layer caching + misc fixes

6 years agolxc-oci: support skopeo layer caching
Felix Abecassis [Fri, 1 Dec 2017 19:04:34 +0000 (11:04 -0800)]
lxc-oci: support skopeo layer caching

This requires skopeo version 0.1.25

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
6 years agolxc-oci: support index files with multiple manifests
Felix Abecassis [Fri, 1 Dec 2017 06:51:57 +0000 (22:51 -0800)]
lxc-oci: support index files with multiple manifests

Previously, the output would contain "null" strings in this case.

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
6 years agolxc-oci: rely on jq instead of sed to transform values
Felix Abecassis [Fri, 1 Dec 2017 06:51:53 +0000 (22:51 -0800)]
lxc-oci: rely on jq instead of sed to transform values

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
6 years agolxc-oci: remove unhelpful comment
Felix Abecassis [Fri, 1 Dec 2017 06:51:47 +0000 (22:51 -0800)]
lxc-oci: remove unhelpful comment

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
6 years agolxc-oci: cleanup temporary download directory if umoci is interrupted
Felix Abecassis [Fri, 1 Dec 2017 06:51:38 +0000 (22:51 -0800)]
lxc-oci: cleanup temporary download directory if umoci is interrupted

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
6 years agoMerge pull request #1955 from flx42/confile-fix-misc-issues
Christian Brauner [Wed, 29 Nov 2017 11:41:39 +0000 (12:41 +0100)]
Merge pull request #1955 from flx42/confile-fix-misc-issues

Fix errors in configuration file parsing

6 years agoconfile_utils: simplify lxc_config_net_hwaddr
Felix Abecassis [Wed, 29 Nov 2017 04:27:53 +0000 (20:27 -0800)]
confile_utils: simplify lxc_config_net_hwaddr

In addition to the memory corruption fixed in ee3e84df78424d26fc6c90862fbe0fa92a686b0d,
this function was also performing invalid memory accesses for the following inputs:
- `lxc.net`
- `lxc.net.`
- `lxc.net.0.`
- `lxc.network`
- `lxc.network.0.`

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
6 years agoconfile: error out if a network configuration key has no subkey
Felix Abecassis [Wed, 29 Nov 2017 04:27:44 +0000 (20:27 -0800)]
confile: error out if a network configuration key has no subkey

This prevent an infinite recursion in the case of "lxc.net.0. = a"

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
6 years agolog: fix infinite loop with multiple lxc.log.syslog keys
Felix Abecassis [Wed, 29 Nov 2017 04:27:39 +0000 (20:27 -0800)]
log: fix infinite loop with multiple lxc.log.syslog keys

This caused the linked list of appenders to loop on itself, creating
an infinite logging loop in `__lxc_log_append`.

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>