Commit Graph

6611 Commits

Author SHA1 Message Date
Christian Brauner
f57ac67f66
cgfsng: controller_found()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 19:09:50 +01:00
Christian Brauner
258449e596
cgfsng: controller_list_is_dup()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 19:09:18 +01:00
Christian Brauner
5c0089ae61
cgfsng: controller_lists_intersect()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 19:08:38 +01:00
Christian Brauner
7793add32c
cgfsng: cg_legacy_handle_cpuset_hierarchy()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 19:07:56 +01:00
Christian Brauner
b095a8ebbb
cgfsng: copy_parent_file()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 19:04:05 +01:00
Christian Brauner
59ac3b88d8
cgfsng: cg_legacy_filter_and_set_cpus()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 19:00:33 +01:00
Christian Brauner
333987b9e5
cgfsng: get_max_cpus()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 18:55:15 +01:00
Christian Brauner
414c6719d5
cgfsng: lxc_cpumask_to_cpulist()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 18:54:10 +01:00
Christian Brauner
d5d468f6f0
cgfsng: lxc_cpumask()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 17:16:52 +01:00
Christian Brauner
5ae0207c84
cgfsng: get_hierarchy()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 17:12:30 +01:00
Christian Brauner
42a993b470
cgfsng: must_append_controller()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 17:11:05 +01:00
Christian Brauner
8073018da7
cgfsng: string_in_list()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 17:09:26 +01:00
Christian Brauner
8b8db2f6af
cgfsng: append_null_to_list()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 17:08:58 +01:00
Christian Brauner
3fd0de4d30
cgfsng: add me to authors
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 17:08:06 +01:00
Christian Brauner
ac01094430
cgfsng: move cg_legacy_must_prefix_named()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 17:06:56 +01:00
Christian Brauner
7745483dbd
cgfsng: cg_legacy_must_prefix_named()
s/must_prefix_named/cg_legacy_must_prefix_named/

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 17:03:38 +01:00
Christian Brauner
2d5fe5bad0
cgfsng: free_string_list()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 16:51:03 +01:00
Christian Brauner
09f3bb13cc
cgfsng: fully document remaining variables
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 16:50:27 +01:00
Christian Brauner
16a2cde9e0
cgfsng: fully document struct cgfsng_handler_data
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 16:45:01 +01:00
Christian Brauner
9e28830178
cgfsng: fully document struct hierarchy
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 16:37:35 +01:00
Christian Brauner
438c4581b0
cgfsng: order includes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 16:32:16 +01:00
Christian Brauner
f6a248c024
Merge pull request #2174 from brauner/2018-02-17/lxc-update-config_check_empty_args
cmd/lxc-update-config: check for empty arguments
2018-02-17 13:37:20 +01:00
Christian Brauner
a514f2d943
cmd/lxc-update-config: check for empty arguments
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 13:36:31 +01:00
Christian Brauner
18b1b540e7
Merge pull request #2173 from brauner/2018-02-17/add_coverity_status
README: add coverity
2018-02-17 13:08:32 +01:00
Christian Brauner
0577a33d33
README: add coverity
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 13:07:14 +01:00
Serge Hallyn
3d7868ae53
Merge pull request #2171 from brauner/2018-02-16/rework_hooks
conf: fix run_script_argv()
2018-02-16 18:51:56 -06:00
Christian Brauner
c06a0555e9
console: ensure that fd is marked EBADF
If the handler closes the file descriptor for the peer or master fd it is
crucial that we mark it as -EBADF. This will prevent lxc_console_delete()
from calling close() on an already closed file descriptor again. I've
observed the double close in the attach code.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-17 00:13:10 +01:00
Christian Brauner
0d0d365516
start: don't call close on invalid file descriptor
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-16 23:18:54 +01:00
Christian Brauner
941138edba
Merge pull request #2172 from stgraber/master
Sabayon fixes
2018-02-16 23:16:19 +01:00
Stéphane Graber
59ee28f21d
lxc-sabayon: Fix handling of eth0
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2018-02-16 16:50:45 -05:00
Stéphane Graber
9bf5cd8dbb
lxc-sabayon: Remove broken/unused code
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2018-02-16 16:49:02 -05:00
Christian Brauner
586b1ce72b
conf: s/argsin/argv/ in run_script_argv()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-16 22:11:19 +01:00
Christian Brauner
6f8d00d279
conf: use malloc() in run_script_argv()
It seems dangerous to use alloca() as the arguments can be of indeterminate
length and we might blow up the stack.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-16 22:10:06 +01:00
Christian Brauner
327cce76ad
conf: fix run_script_argv()
Make sure that we allocate the buffer **after** we determined how much space we
need in total.
This fixes a SIGBUS/SIGSEGV Stéphane reported on aarch64 and armf.

Reported-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-16 22:04:35 +01:00
Stéphane Graber
47d4e397da
Merge pull request #2170 from brauner/2018-02-16/cgfsng_force_cgroup_mount
confile: add "force" to cgroup:{mixed,ro,rw}
2018-02-16 14:47:54 -05:00
Christian Brauner
7e50ec0b5f
utils: fix lxc_p{close,open}()
If a file descriptor fd is opened by fdopen() and associated with a stream f
will **not** have been dup()ed. This means that fclose(f) will also close the
fd. So never call close(fd) after fdopen(fd) succeeded.
This fixes a double close() Stéphane and I observed when debugging on aarch64
and armf.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-16 20:06:48 +01:00
Christian Brauner
e99cf4acfd
tests: remove lxc-test-ubuntu
This is really taking a long time for not a lot of benefit.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-16 16:02:09 +01:00
Christian Brauner
ed06b69ce6
CODING_STYLE: add section for str{n}cmp()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-16 16:02:08 +01:00
Christian Brauner
8353b4c90e
conf: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-16 16:02:08 +01:00
Shukui Yang
3f69fb12c1
confile: add "force" to cgroup:{mixed,ro,rw}
This lets users specify

        lxc.mount.auto = cgroup:mixed:force
or
        lxc.mount.auto = cgroup:ro:force
or
        lxc.mount.auto = cgroup:rw:force

When cgroup namespaces are supported LXC will not mount cgroups for the
container since it assumes that the init system will mount cgroups itself if it
wants to. This assumption already broke when users wanted to run containers
without CAP_SYS_ADMIN. For example, systemd based containers wouldn't start
since systemd needs to mount cgroups (named systemd hierarchy for legacy
cgroups and the unified hierarchy for unified cgroups) to track processes. This
problem was solved by detecting whether the container had CAP_SYS_ADMIN. If it
didn't we performed the cgroup mounts for it.
However, there are more cases when we should be able to mount cgroups for the
container when cgroup namespaces are supported:
- init systems not mounting cgroups themselves:
  A init system that doesn't mount cgroups would not have cgroups available
  especially when combined with custom LSM profiles to prevent cgroup
  {u}mount()ing inside containers.
- application containers:
  Application containers will usually not mount by cgroups themselves.
- read-only cgroups:
  It is useful to be able to mount cgroups read-only to e.g. prevent
  changing cgroup limits from inside the container while at the same time
  allowing the applications to perform introspection on their own cgroups. This
  again is mostly useful for application containers. System containers running
  systemd will usually not work correctly when cgroups are mounted read-only.
To be fair, all of those use-cases could be covered by custom hooks or
lxc.mount.entry entries but exposing it through lxc.mount.auto takes care of
setting correct mount options and adding the necessary logic to e.g. mount
filesystem read-only correctly.

Currently we only extend this to cgroup:{mixed,ro,rw} but technically there's
no reason not to enable the same behavior for cgroup-full:{mixed,ro,rw} as
well. If someone requests this we can simply treat it as a bug and add "force"
for cgroup-full.

Replaces #2136.

Signed-off-by: Shukui Yang <yangshukui@huawei.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-16 16:01:53 +01:00
Stéphane Graber
f3793175d6
Merge pull request #2166 from brauner/2018-02-15/fix_cgfsng_chown
cgroups: use correct mask for chmod()
2018-02-14 18:30:38 -05:00
Christian Brauner
63e42fee6e
cgroups: use correct mask for chmod()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-15 00:28:42 +01:00
Serge Hallyn
80c1390dff
Merge pull request #2165 from brauner/2018-02-14/coding_style
CODING_STYLE: add coding style file
2018-02-14 13:03:18 -06:00
Christian Brauner
4a308d6693
CODING_STYLE: add CODING_STYLE.md
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-14 19:58:05 +01:00
Christian Brauner
b706b2eee7
CONTRIBUTING: update
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-14 13:04:48 +01:00
Stéphane Graber
bb540ac370
Merge pull request #2163 from brauner/2018-02-13/fix_cgroup_chown
cgfsng: simplifications and fixes
2018-02-14 00:20:51 -05:00
Christian Brauner
df3c5314d2
start: s/||/&&/ when mapping ids
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-14 00:19:42 +01:00
Christian Brauner
6efacf80e8
cgfsng: simplifications and fixes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-13 21:09:16 +01:00
Stéphane Graber
2b0991f10a
Merge pull request #2162 from brauner/2018-02-10/remove_openpty_lock
lxclock: remove atfork handlers
2018-02-13 13:53:03 -05:00
Christian Brauner
0e7ff52c92
tree-wide: remove cgmanager
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-13 05:39:58 +01:00