Skip to content

Commit

Permalink
cgroups: make device cgroups semantics clearer
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Feb 18, 2021
1 parent 0d450ef commit 69885a7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/lxc/cgroups/cgfsng.c
Expand Up @@ -2772,18 +2772,21 @@ static int device_cgroup_rule_parse(struct device_item *device, const char *key,
char temp[50];

if (strequal("devices.allow", key))
device->allow = 1;
device->allow = 1; /* allow the device */
else
device->allow = 0;
device->allow = 0; /* deny the device */

if (strequal(val, "a")) {
/* global rule */
device->type = 'a';
device->major = -1;
device->minor = -1;
device->global_rule = device->allow
? LXC_BPF_DEVICE_CGROUP_DENYLIST
: LXC_BPF_DEVICE_CGROUP_ALLOWLIST;

if (device->allow) /* allow all devices */
device->global_rule = LXC_BPF_DEVICE_CGROUP_DENYLIST;
else /* deny all devices */
device->global_rule = LXC_BPF_DEVICE_CGROUP_ALLOWLIST;

device->allow = -1;
return 0;
}
Expand Down

0 comments on commit 69885a7

Please sign in to comment.