Commit Graph

9144 Commits

Author SHA1 Message Date
Christian Brauner
b18f6aac91
lxccontainer: replace logging functions
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-07 17:31:36 +01:00
Christian Brauner
bf39128d81
confile_utils: replace logging functions
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-07 17:31:21 +01:00
Christian Brauner
341e6516f2
cgroups: rework return values of some functions
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-07 17:30:57 +01:00
Christian Brauner
55cc111685
cgroups/cgroup2_devices: replace logging functions
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-07 17:30:07 +01:00
Christian Brauner
102dca2622
cgroups/cgroup: replace logging functions
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-07 17:29:12 +01:00
Christian Brauner
d220323012
cgroups/cgfsng: replace logging functions
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-07 17:28:06 +01:00
Christian Brauner
21fce08cb6
confile: replace logging helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-07 17:25:28 +01:00
Christian Brauner
596a002c68
network: replace logging helpers
s/error_log_errno(/log_error_errno(-1, /g
s/minus_one_set_errno(/ret_set_errno(-1, /g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-07 17:24:29 +01:00
Christian Brauner
3d0327ed24
commands: replace logging helpers
s/error_log_errno(/log_error_errno(-1, /g
s/minus_one_set_errno(/ret_set_errno(-1, /g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-07 17:23:24 +01:00
Christian Brauner
540a2f7092
attach: s/minus_one_set_errno(/ret_set_errno(-1, /g
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-07 17:22:53 +01:00
Christian Brauner
db1b8b0f5e
af_unix: s/minus_one_set_errno(/ret_set_errno(-1, /g
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-07 17:22:14 +01:00
Christian Brauner
9958e6fe7f
macro: add ret_errno()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-07 17:21:53 +01:00
Christian Brauner
2b0c584613
log: rearrange
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-07 17:21:18 +01:00
Stéphane Graber
0374aacd73
Merge pull request #3215 from brauner/cgroup2_controller_delegation
cgroup2: rework controller delegation
2019-12-06 09:54:57 -05:00
Christian Brauner
c581d2a673
cgroup2: rework controller delegation
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-06 15:38:33 +01:00
Christian Brauner
92ef1f8ae2
Merge pull request #3214 from Rachid-Koucha/patch-1
"busy" field init to -1 instead of 0
2019-12-06 15:34:14 +01:00
Christian Brauner
6b3dccea88
Merge pull request #3213 from blenk92/fix-mount-parsing
config: Fix parsing of mount options
2019-12-06 15:10:27 +01:00
Rachid Koucha
730aaf46e0
"busy" field set to -1 instead of 0
"busy" field is assigned with the command socket descriptor when the terminal is in use. So, use "-1" to disable it.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-12-06 15:07:47 +01:00
Rachid Koucha
7581d645ee
"busy" field set to 1 instead of 0
"busy" field is assigned with the command socket descriptor when the terminal is in use. So, use "-1" to disable it.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-12-06 15:04:31 +01:00
Rachid Koucha
dd3de5683d
Init "busy" field to -1 as 0 is valid fd
"busy" field is assigned with the command socket descriptor when the terminal is in use. So, use "-1" to disable it.
Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-12-06 14:59:52 +01:00
Maximilian Blenk
85c2de3902 config: Fix parsing of mount options
When parsing mount options e.g. from lxc.mount.entry the specified
options are mapped to the flags constants. To do so, the strings
are compared to the options contained in mount_opt. However,
when comparing the strings, the length of the string is not
checked. That entails that the option "rootcontext=selinux-context"
is mapped to the mount option read-only (ro). This commit fixes
this issue by checking if a '=' is contained in the specified option
and additionally comparing the length of the strings.

Signed-off-by: Maximilian Blenk <Maximilian.Blenk@bmw.de>
2019-12-06 14:17:37 +01:00
Stéphane Graber
750012991f
Merge pull request #3204 from brauner/switch_to_spdx
lxc: switch to SPDX
2019-12-04 09:59:20 -05:00
Stéphane Graber
8a7d02b712
Merge pull request #3207 from brauner/cgroup2_improvements_2
cgroups: improve container cgroup attaching
2019-12-04 09:57:57 -05:00
Christian Brauner
9994db5125
cgroups/devices: correctly verify bpf device useability in cgfsng_devices_activate()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-04 14:03:48 +01:00
Christian Brauner
900b660658
cgroups: improve container cgroup attaching
The current attach.c codepath which handles moving the attaching process into
the container's cgroups allocates a whole new struct cgroup_ops and goes
through the trouble of reparsing the whole cgroup layout.
That's costly and wasteful. My plan has always been to move this into the
command api by getting fds for attaching back but but it's not worth going
through that hazzle for non-unified hosts. On pure unified hosts however -
being the future - we can just attach through a single fd so there's no need to
allocate and setup struct cgroup_ops.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-04 13:53:56 +01:00
Christian Brauner
cc73685dd0
lxc: switch to SPDX
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-04 13:48:46 +01:00
Christian Brauner
23a917e5d2
commands: use logging return helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-04 13:26:23 +01:00
Stéphane Graber
c10ac1b13b
Merge pull request #3205 from brauner/cgroup2_improvements
cgroup: add command to retrieve cgroup2 fd and rework cgroup2 attach
2019-12-03 22:57:08 -05:00
Christian Brauner
bad788b08f
cgfsng: rework cgroup2 attach
On pure unified systemd we can use a single file descriptor to interact with
the cgroup filesystem. Add a method to retrieve it and as a start use it in our
unified attach codepath.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-04 02:56:25 +01:00
Christian Brauner
6900ebfa2d
cgroups/devices: do not log error when bpf device feature is not available
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-04 00:55:42 +01:00
Stéphane Graber
02294d4ef7
Merge pull request #3203 from brauner/freezer_fixes
freezer: cleanup
2019-12-03 17:41:11 -05:00
Christian Brauner
397572003c
Merge pull request #2842 from brauner/2019-02-11/fix_licensing
tree-wide: Fix inconsistent license headers
2019-12-03 20:39:25 +01:00
Christian Brauner
d47ff01b75
freezer: cleanup
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-03 20:35:45 +01:00
Christian Brauner
22f0dd49ae
Merge pull request #3178 from xinhua9569/master
conf: fix memory leak for set config rootfs options
2019-12-03 20:25:18 +01:00
Stéphane Graber
9c3f1c584b
Merge pull request #3202 from brauner/cgroup2_freezer_fixes
cgroups/freezer: rework cgroup2 freezer feature usage
2019-12-03 10:34:49 -05:00
Christian Brauner
018051e37d
cgroups/freezer: fix and improve cgroup2 freezer implementation
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-03 16:07:07 +01:00
Christian Brauner
dca9587a61
cgroups: add DEFAULT_MOUNTPOINT #define
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-03 15:37:53 +01:00
Stéphane Graber
9346110a46
Merge pull request #3196 from brauner/cgroup2_devices_fixes_2
cgroups/devices: use dedicated enums
2019-12-01 20:52:08 -05:00
Christian Brauner
356e71c616
cgroups/devices: use dedicated enums
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-02 00:50:06 +01:00
Stéphane Graber
3e32a62647
Merge pull request #3195 from brauner/cgroup2_devices_fixes
cgroup2: add bpf device controller live update
2019-12-01 15:17:34 -05:00
Christian Brauner
fda39d451e
cgroups/devices: introduce ebpf device cgroup global rule types
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-01 19:39:48 +01:00
Christian Brauner
30da741c50
cgroups/devices: handle NULL
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-01 19:08:43 +01:00
Christian Brauner
68a9e3ebcb
configure: enable -Wunused-but-set-variable
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-01 17:07:25 +01:00
Christian Brauner
2a63b5cb7f
cgroups/cgfsng: implement cgroup2 device controller live update
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-01 17:07:23 +01:00
Christian Brauner
4bfb655ea8
conf: record cgroup2 devices in parsed format
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-01 11:56:43 +01:00
Christian Brauner
cce5a3d716
cgroups/cgfsng: "atomically" replace bpf device programs
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-01 11:56:43 +01:00
Christian Brauner
46383a85a9
macro: remove unused macros
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-01 11:56:43 +01:00
Christian Brauner
e4dffa2f97
api_extension: add cgroup2_devices api extension
This will only be defined if liblxc was even compiled with bpf supported.
Support itself will be determined at runtime by liblxc itself.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-12-01 11:56:43 +01:00
Stéphane Graber
637de040ae
Merge pull request #3194 from brauner/cgroup2_devices
cgroups: add cgroup2 device controller support
2019-11-29 14:28:27 -05:00
Christian Brauner
bf6519892e
cgroups: add cgroup2 device controller support
Add a bpf-based device controller implementation.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-11-29 17:10:13 +01:00