Commit Graph

6827 Commits

Author SHA1 Message Date
Christian Brauner
48d02a2f03
Merge pull request #2288 from lifeng68/Fix_mem_leak_cgfsng_attach
Fix the memory leak in cgfsng_attach
2018-04-24 10:40:22 +02:00
LiFeng
71cb9afb44 Fix the memory leak in cgfsng_attach
Signed-off-by: LiFeng <lifeng68@huawei.com>
2018-04-24 12:53:57 -04:00
Christian Brauner
d31660efe7
Merge pull request #2287 from thyth/master
Also pass action scripts to CRIU on checkpointing
2018-04-24 10:16:04 +02:00
Daniel Selifonov
497a78630c Also pass action scripts to CRIU on checkpointing
Signed-off-by: Daniel Selifonov <ds@thyth.com>
2018-04-23 23:03:44 -07:00
Christian Brauner
31283a46ac
Merge pull request #2284 from 3XX0/pamcgfs-ignore-umask
pam-cgfs: ignore the system umask when creating the cgroup hierarchy
2018-04-23 23:09:39 +02:00
Jonathan Calmels
c4a4578fa0 pam-cgfs: ignore the system umask when creating the cgroup hierarchy
Fixes: #2277
Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
2018-04-23 13:24:11 -07:00
Christian Brauner
5dfc91865b
Merge pull request #2285 from tpetazzoni/offsetof-stddef-fix
lxc/tools/lxc_monitor: include missing <stddef.h>
2018-04-20 13:00:07 +02:00
Thomas Petazzoni
77d407537f lxc/tools/lxc_monitor: include missing <stddef.h>
lxc_monitor.c uses offsetof(), so it should include
<stddef.h>. Otherwise the build fails with the musl C library:

tools/lxc_monitor.c: In function ‘lxc_abstract_unix_connect’:
tools/lxc_monitor.c:324:9: warning: implicit declaration of function ‘offsetof’ [-Wimplicit-function-declaration]
         offsetof(struct sockaddr_un, sun_path) + len + 1);
         ^~~~~~~~
tools/lxc_monitor.c:324:18: error: expected expression before ‘struct’
         offsetof(struct sockaddr_un, sun_path) + len + 1);
                  ^~~~~~

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-04-20 12:26:33 +02:00
Christian Brauner
7d675310ae
Merge pull request #2283 from flx42/lxc-oci-mkdir-download-directory
lxc-oci: mkdir the download directory
2018-04-19 15:07:05 +02:00
Felix Abecassis
8c7536ecf2 lxc-oci: mkdir the download directory
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2018-04-18 14:12:55 -07:00
Serge Hallyn
a5fb69a3f1
Merge pull request #2281 from brauner/2018-04-15/seccomp_fixes
seccomp: handle arch inversion - The Architecture Strikes Back
2018-04-18 11:35:11 -05:00
Christian Brauner
eca6736eb0
seccomp: handle arch inversion II
LXC generates and loads the seccomp-bpf filter in the host/container which
spawn the new container. In other words, userspace N is responsible for
generating and loading the seccomp-bpf filter which restricts userspace N + 1.
Assume 64bit kernel and 32bit userspace running a 64bit container. In this case
the 32-bit x86 userspace is used to create a seccomp-bpf filter for a 64-bit
userspace. Unless one explicitly adds the 64-bit ABI to the libseccomp filter,
or adjusts the default behavior for "BAD_ARCH", *all* 64-bit x86 syscalls will
be blocked.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Suggested-by: Paul Moore <paul@paul-moore.com>
2018-04-18 16:00:54 +02:00
Christian Brauner
7e84441ec3
seccomp: non-functional changes
Rename "compat_ctx" to "contexts" and "compat_arch" to "architectures".

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-18 14:40:49 +02:00
Christian Brauner
4160ef02e5
tools: document -d/--daemonize for lxc-execute
Closes #2280.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-15 22:43:21 +02:00
Christian Brauner
94d5605414
seccomp: improve logging
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-15 22:39:07 +02:00
Christian Brauner
d648e178f1
seccomp: cleanup compat architecture handling
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-15 22:12:51 +02:00
Stéphane Graber
a55e2ad107
Merge pull request #2275 from brauner/2018-04-13/improve_seccomp
seccomp: handle all errors
2018-04-13 18:20:33 +02:00
Christian Brauner
adfee3a873
seccomp: handle all errors
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-13 18:00:23 +02:00
Serge Hallyn
2c80e9cf15
Merge pull request #2274 from brauner/2018-04-13/fix_seccomp_with_personality_and_64bit_kernel_32_bit_userspace
seccomp: handle arch inversion
2018-04-13 10:29:18 -05:00
Christian Brauner
b5ed021bbc
seccomp: handle arch inversion
This commit deals with different kernel and userspace layouts and nesting. Here
are three examples:
1. 64bit kernel and 64bit userspace running 32bit containers
2. 64bit kernel and 32bit userspace running 64bit containers
3. 64bit kernel and 64bit userspace running 32bit containers running 64bit containers
Two things to lookout for:
1. The compat arch that is detected might have already been present in the main
   context. So check that it actually hasn't been and only then add it.
2. The contexts don't need merging if the architectures are the same and also can't be.
With these changes I can run all crazy/weird combinations with proper seccomp
isolation.

Closes #654.

Link: https://bugs.chromium.org/p/chromium/issues/detail?id=832366
Reported-by: Chirantan Ekbote <chirantan@chromium.org>
Reported-by: Sonny Rao <sonnyrao@chromium.org>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-13 14:11:09 +02:00
Christian Brauner
bf5afb0174
Merge pull request #2273 from aither64/master
conf: fix net type checks in run_script_argv()
2018-04-13 10:39:05 +02:00
Jakub Skokan
a81442634e conf: fix net type checks in run_script_argv()
Signed-off-by: Jakub Skokan <jakub.skokan@havefun.cz>
2018-04-13 09:03:20 +02:00
Serge Hallyn
465c891a7b
Merge pull request #2272 from brauner/2018-04-12/bugfixes
conf: ret-try devpts mount without gid=5 on error
2018-04-12 11:31:05 -05:00
Christian Brauner
794248d09d
execute: fix app containers without root mapping
When starting application containers without a mapping for container root are
started, a dummy bind-mount target for lxc-init needs to be created. This will
not always work directly under "/" when e.g. permissions are missing due to the
ownership and/or mode of "/". We can try to work around this by using the
P_tmpdir as defined in POSIX which should usually land us in /tmp where
basically everyone can create files.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-12 17:37:53 +02:00
Christian Brauner
112930688b
conf: ret-try devpts mount without gid=5 on error
We should always default to mounting devpts with gid=5 but we should fallback
to mounting without gid=5. This let's us cover use-cases such as container
started with only a single mapping e.g.:

lxc.idmap = u 1000 1000 1
lxc.idmap = g 1000 1000 1

Closes #2257.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-12 12:48:58 +02:00
Serge Hallyn
855452aede
Merge pull request #2270 from brauner/2018-04-11/attach_try_dropping_supplementary_groups
attach: try to always drop supplementary groups
2018-04-11 18:00:35 -05:00
Serge Hallyn
33c7c7feb2
Merge pull request #2259 from gjaekel/patch-1
rootfs pinning: On NFS, make file hidden but don't delete it
2018-04-11 12:24:59 -05:00
Christian Brauner
96ec54acf8
attach: try to always drop supplementary groups
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-11 17:35:57 +02:00
Stéphane Graber
3d435963b7
Merge pull request #2266 from brauner/2018-04-09/attach_drop_suppl_groups
attach: always drop supplementary groups
2018-04-10 14:14:34 +02:00
Christian Brauner
9e320621fd
utils: define __NR_setns if missing on old glibcs
Closes #2248.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-10 12:27:39 +02:00
Christian Brauner
e456a1ef55
Merge pull request #2267 from brauner/QbitLogic-master
Mergeable branch for C0deAi fixes
2018-04-09 21:00:36 +02:00
Christian Brauner
d6d727aff1
lxc init: coding style
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-09 20:44:14 +02:00
C0deAi
74269047b4
tools/utils: free memory on error
Closes #2262.

Signed-off-by: C0deAi <techsupport@mycode.ai>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-09 20:40:13 +02:00
C0deAi
55d83a7c72
storage/rsync: free memory on error
Closes #2262.

Signed-off-by: C0deAi <techsupport@mycode.ai>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-09 20:40:09 +02:00
C0deAi
125a2e044c
lxc init: remove dead code
Value stored is never read.

Closes #2262.

Signed-off-by: C0deAi <techsupport@mycode.ai>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-09 20:40:02 +02:00
Christian Brauner
24927339bd
attach: always drop supplementary groups
Closes #1704.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-09 18:01:38 +02:00
Christian Brauner
4e256f6fe1
Merge pull request #2263 from ffontaine/master
Fix compilation with static libcap and shared gnutls
2018-04-09 10:15:09 +02:00
Fabrice Fontaine
49bc916b1d Fix compilation with static libcap and shared gnutls
Commit c06ed219c4 has broken
compilation with a static libcap and a shared gnutls.
This results in a build failure on init_lxc_static if gnutls is
a shared library as init_lxc_static is built with -all-static option
(see src/lxc/Makefile.am) and AC_CHECK_LIB adds gnutls to LIBS.

This commit fix the issue by removing default behavior of AC_CHECK_LIB
and handling manually GNUTLS_LIBS and HAVE_LIBGNUTLS

Fixes:
 - http://autobuild.buildroot.net/results/b655d6853c25a195df28d91512b3ffb6c654fc90

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2018-04-07 18:12:12 +02:00
Christian Brauner
5eda487c1c
Merge pull request #2261 from brauner/2018-04-06/thmo_patch_1
Fix temp file creation
2018-04-06 16:24:25 +02:00
Christian Brauner
709384a02e
ringbuf: fix temporary file creation
lxc_make_tmpfile() uses mkstemp() internally, and thus expects the
template to contain 'XXXXXX' and be writable.

Signed-off-by: Thomas Moschny <thomas.moschny@gmx.de>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-06 10:54:41 +02:00
Christian Brauner
a324e7eba0
conf: fix temporary file creation
lxc_make_tmpfile() uses mkstemp() internally, and thus expects the
template to contain 'XXXXXX' and be writable.

Signed-off-by: Thomas Moschny <thomas.moschny@gmx.de>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-06 10:54:02 +02:00
Guido Jäkel
63fc76c3e0
rootfs pinning: On NFS, make file hidden but don't delete it
On NFS, avoid random names of the root pin file due to "NFS silly renaming" but use a fixed hidden name instead.
2018-04-06 09:35:21 +02:00
Serge Hallyn
83ffaa1d39
Merge pull request #2258 from tych0/fix-signal-sending-to-lxc-init
fix signal sending in lxc.init
2018-04-05 16:03:44 -05:00
Tycho Andersen
9cb943843a fix signal sending in lxc.init
The problem here is that these two clauses were ordered backwards: we first
check if the signal came from not the init pid, and if it did, then we give
a notice and return. The comment notes that this is intended to protect
against SIGCHLD, but we don't in fact know if the signal is a SIGCHLD yet,
because that's tested in the next hunk.

The symptom is that if I e.g. send SIGTERM from the outside world to the
container init, it ignores it and gives this notice. If we re-order these
clauses, it forwards non SIGCHLD signals, and ignores SIGCHLD signals from
things that aren't the real container process.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-04-04 17:50:50 -06:00
Christian Brauner
22b2b9c87c
Merge pull request #2256 from tenforward/japanese
doc: Tweak Japanese translation in lxc.container.conf(5)
2018-04-03 15:00:08 +02:00
KATOH Yasufumi
09dd49ab20 doc: Tweak Japanese translation in lxc.container.conf(5)
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2018-04-03 21:29:09 +09:00
Christian Brauner
94b437d17d
Merge branch 'FengtuWang-make_rslave' into lxc/master 2018-04-02 15:58:06 +02:00
Fengtu Wang
e599717bc5
conf: ensure umounts don't propagate to host
Signed-off-by: Fengtu Wang <wangfengtu@huawei.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-02 15:56:40 +02:00
Stéphane Graber
0474e8a8e5
Merge pull request #2247 from brauner/2018-03-31/expand_lxc_environment
confile: expand lxc.environment
2018-04-02 01:08:39 -04:00
Christian Brauner
5eab47bce5
confile: expand lxc.environment
When a bare environment variable is specified then retrieve the value from the
current environment. For example, setting

lxc.environment = PATH

will cause LXC to inherit the value of PATH from the current environment.

Suggested-by: Jonathan Calmels <jcalmels@nvidia.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-03-31 17:57:00 +02:00