Commit Graph

6564 Commits

Author SHA1 Message Date
Christian Brauner
ef1ab8f10d
lxccontainer: config_file_exists()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:38:05 +01:00
Christian Brauner
238b3e5ea4
lxccontainer: move macros to utils.h
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:38:03 +01:00
Christian Brauner
0e1a60b0fb
lxccontainer: do_lxcapi_save_config()
If liblxc is used multi-threaded do_lxcapi_save_config() could be called from
threads that fork() which to not risk ending up with invalid locking states we
should avoid using functions like fopen() that internally allocate memory and
use locking. Let's replace it with the async-signal safe combination of
open() + write().

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:38:02 +01:00
Christian Brauner
a30b9023a0
network: lxc_delete_network_unpriv_exec()
thread-safety: s/exit()/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:38:00 +01:00
Christian Brauner
780700561e
network: lxc_create_network_unpriv_exec()
thread-safety: s/exit()/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:59 +01:00
Christian Brauner
ebd582aeea
network: lxc_netdev_move_wlan()
thread-safety: s/exit()/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:58 +01:00
Christian Brauner
05ec44f842
network: lxc_netdev_rename_by_name_in_netns()
thread-safety: s/exit()/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:57 +01:00
Christian Brauner
d8b3f9c34a
utils: run_command()
thread-safety: s/exit()/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:56 +01:00
Christian Brauner
03f618afc3
utils: lxc_popen()
thread-safety: s/exit()/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:54 +01:00
Christian Brauner
7249588c79
lxclock: {un}lock_mutex()
thread-safety: s/exit()/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:53 +01:00
Christian Brauner
8d7b6c25af
lxccontainer: do_lxcapi_detach_interface()
thread-safety: s/exit()/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:52 +01:00
Christian Brauner
a7764ce792
lxccontainer: do_add_remove_node()
thread-safety: s/exit()/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:51 +01:00
Christian Brauner
d8480a31b4
lxccontainer: do_lxcapi_clone()
thread-safety: s/exit()/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:50 +01:00
Christian Brauner
fe1ce58c9a
lxccontainer: do_lxcapi_get_ips()
thread-safety: s/exit/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:49 +01:00
Christian Brauner
02c611b013
lxccontainer: do_lxcapi_get_interfaces()
thread-safety: s/exit()/_exit/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:47 +01:00
Christian Brauner
85aec4aca7
lxccontainer: do_lxcapi_create()
thread-safety: s/exit()/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:46 +01:00
Christian Brauner
47e558874c
lxccontainer: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:45 +01:00
Christian Brauner
7e34710e5d
lxccontainer: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:44 +01:00
Christian Brauner
eb70aaf0d6
lxccontainer: create_run_template()
thread_safety: s/exit()/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:42 +01:00
Christian Brauner
d608fbdadb
lxccontainer: do_lxcapi_start()
thread-safety: s/exit()/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:41 +01:00
Christian Brauner
9994d1402c
confile: use mmap() to parse config file
Sigh, this is going to be fun. Essentially, dynamic memory allocation through
malloc() and friends is unsafe when fork()ing in threads. The locking state
that glibc maintains internally might get messed up when the process that
fork()ed calls malloc or calls functions that malloc() internally. Functions
that internally malloc() include fopen(). One solution here is to use open() +
mmap() instead of fopen() + getline().

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-24 21:37:39 +01:00
Christian Brauner
1401329e77
Merge pull request #2182 from tenforward/japanese
doc: Add cgroup-full:*:force to Japanese lxc.container.conf(5)
2018-02-22 11:06:34 +01:00
KATOH Yasufumi
dc55f0051a doc: Add cgroup-full:*:force to Japanese lxc.container.conf(5)
Update for commit e7806b2

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2018-02-22 13:54:03 +09:00
Stéphane Graber
1eae7a4069
Merge pull request #2181 from brauner/2018-02-22/fix_root_owned_unprivileged_containers
cgfsng: fix off-by-one error
2018-02-21 19:38:25 -05:00
Christian Brauner
cbe2185b81
cgfsng: fix off-by-one error
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-22 01:28:20 +01:00
Stéphane Graber
79cf25e826
Revert "pam: create writable cgroups for unpriv users"
This reverts commit 7995662124.

Before we can merge something like this we need to have it be behind a
configure flag and quite probably be an opt-in feature (--enable-pam).

This should fix Jenkins, PPA builds and the current binary conflicts
between the lxcfs and lxc package builds (snap and archive).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2018-02-21 17:25:58 -05:00
Serge Hallyn
e235f961bf
Merge pull request #2148 from brauner/2018-02-09/move_pam_module_to_liblxc
pam: create writable cgroups for unpriv users
2018-02-21 13:27:59 -06:00
Stéphane Graber
275b76d27b
Merge pull request #2179 from brauner/2018-02-21/docs_add_cgroup_full_force
doc: document cgroup-full:{mixed,ro,rw}:force
2018-02-21 12:23:14 -05:00
Christian Brauner
a763deecfb
Merge pull request #2180 from tenforward/japanese
Update Japanese lxc.container.conf(5)
2018-02-21 12:22:58 +01:00
KATOH Yasufumi
3e2bb54b2e doc: Improve Japanese translation in lxc.container.conf(5)
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2018-02-21 20:17:15 +09:00
KATOH Yasufumi
3f163e459f doc: add "force" option of lxc.mount.auto to Japanese lxc.container.conf(5)
Update for commit 3f69fb1, and and reduce commentnized English line.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2018-02-21 20:12:59 +09:00
KATOH Yasufumi
07410c63a4 doc: Add the describe of mount propagation to Japanese lxc.container.conf(5)
Update for commit d840039

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2018-02-21 19:36:03 +09:00
KATOH Yasufumi
a2fbabedb2 doc: Add lxc.namespace.{clone,keep} to Japanese lxc.container.conf(5)
Update for commit 46186ac

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2018-02-21 19:27:28 +09:00
KATOH Yasufumi
1fe33b7b90 doc: Update to lxc.namespace.share.* in Japanese lxc.container.conf(5)
change from lxc.namespace.* to lxc.namespace.share.*.
Update for commit b074bbf

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2018-02-21 18:37:33 +09:00
KATOH Yasufumi
2021665823 doc: add lxc.cgroup2.* to Japanese lxc.container.conf(5)
Update for commit 54860ed

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2018-02-21 18:34:23 +09:00
Christian Brauner
5038d11a98
utils: include linux/types.h
Closes #2178.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-21 10:13:12 +01:00
Christian Brauner
e7806b2eff
doc: document cgroup-full:{mixed,ro,rw}:force
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-21 10:06:56 +01:00
Serge Hallyn
6800288122
Merge pull request #2175 from brauner/2018-02-17/coding_style_fixes
tree-wide: coding style + fixes
2018-02-19 12:15:36 -06:00
Christian Brauner
49beb65eb9
cgroups: remove cgroup_create_legacy()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-19 12:56:40 +01:00
Christian Brauner
d2a4d1db03
cgroups: implement "driver" and "driver_version"
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-19 12:56:25 +01:00
Christian Brauner
1a8848b371
cgroups: remove legacy cgfs cgroup driver
The time has come to remove the cgfs cgroup driver as well. I'm doing this for
mainly two reasons:
- potential security issue:
  The cgfs cgroup driver has been unmaintained for a long time now. It did not
  receive new functionality apart from bugfixes. Now that cgroup2 is a thing
  the internal logic how to deal with cgroups has been substantially reworked
  for the cgfsng driver. Given that we won't do the same work for the cgfs
  driver I smell bugs all over the place in the near future. I don't want to
  wake up to a security issue where someone forces LXC to fallback to the cgfs
  driver to exploit bugs when e.g. running in a pure unified cgroup layout.
- code complexity:
  The cgfs cgroup driver is massively complex since it tried to figure out
  where the mountpoint for each legacy cgroup hierarchy is, i.e. it didn't make
  simplyfing assumptions like cgfsng does about where the cgroup hierarchies -
  legacy or unified - would be mounted. This was appropriate before cgroup
  mounting has been standardized. Nowadays, anyone who mounts cgroups not under
  /sys/fs/cgroup is on their own. Furthermore, with unified hierarchy cgroup
  layouts there will only be a single hierarchy mounted at /sys/fs/cgroup so
  there's even less need to drag the complex parsing in cgfs into the future.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-19 12:49:45 +01:00
Christian Brauner
6812d83301
cgfsng: enable "force" for "cgroup-full"
This enables cgroup-full:{mixed,ro,rw}:force and reworks the mount logic.
When cgroup-full was specified we used to bind-mount the cgroups from the host.
That is pretty weird thing to do given that you can simply mount them directly
without going through bind-mounts.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-19 12:30:51 +01:00
Christian Brauner
becad0ec98
start: cleanup namespace handling
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-19 11:52:32 +01:00
Christian Brauner
1fd0f41eff
utils: add lxc_set_death_signal()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-19 10:58:56 +01:00
Christian Brauner
46800e7713
start: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-19 10:23:32 +01:00
Christian Brauner
134df64540
start: do_destroy_container()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-19 00:49:47 +01:00
Christian Brauner
ae3beac9af
start: lxc_destroy_container_on_signal()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-19 00:49:29 +01:00
Christian Brauner
4c8e880e32
start: post_start()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-19 00:48:03 +01:00
Christian Brauner
984984e4f7
start: start()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-19 00:47:46 +01:00
Christian Brauner
c30e9b193e
start: lxc_start()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-19 00:47:19 +01:00