cgroups: make device cgroups semantics clearer

parent 9b7d34a2
...@@ -2770,18 +2770,21 @@ static int device_cgroup_rule_parse(struct device_item *device, const char *key, ...@@ -2770,18 +2770,21 @@ static int device_cgroup_rule_parse(struct device_item *device, const char *key,
char temp[50]; char temp[50];
if (strequal("devices.allow", key)) if (strequal("devices.allow", key))
device->allow = 1; device->allow = 1; /* allow the device */
else else
device->allow = 0; device->allow = 0; /* deny the device */
if (strequal(val, "a")) { if (strequal(val, "a")) {
/* global rule */ /* global rule */
device->type = 'a'; device->type = 'a';
device->major = -1; device->major = -1;
device->minor = -1; device->minor = -1;
device->global_rule = device->allow
? LXC_BPF_DEVICE_CGROUP_DENYLIST if (device->allow) /* allow all devices */
: LXC_BPF_DEVICE_CGROUP_ALLOWLIST; device->global_rule = LXC_BPF_DEVICE_CGROUP_DENYLIST;
else /* deny all devices */
device->global_rule = LXC_BPF_DEVICE_CGROUP_ALLOWLIST;
device->allow = -1; device->allow = -1;
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment