aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/cgroups/devices.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/cgroups/devices.txt')
-rw-r--r--Documentation/cgroups/devices.txt70
1 files changed, 67 insertions, 3 deletions
diff --git a/Documentation/cgroups/devices.txt b/Documentation/cgroups/devices.txt
index 16624a7f8222..3c1095ca02ea 100644
--- a/Documentation/cgroups/devices.txt
+++ b/Documentation/cgroups/devices.txt
@@ -13,9 +13,7 @@ either an integer or * for all. Access is a composition of r
13The root device cgroup starts with rwm to 'all'. A child device 13The root device cgroup starts with rwm to 'all'. A child device
14cgroup gets a copy of the parent. Administrators can then remove 14cgroup gets a copy of the parent. Administrators can then remove
15devices from the whitelist or add new entries. A child cgroup can 15devices from the whitelist or add new entries. A child cgroup can
16never receive a device access which is denied by its parent. However 16never receive a device access which is denied by its parent.
17when a device access is removed from a parent it will not also be
18removed from the child(ren).
19 17
202. User Interface 182. User Interface
21 19
@@ -50,3 +48,69 @@ task to a new cgroup. (Again we'll probably want to change that).
50 48
51A cgroup may not be granted more permissions than the cgroup's 49A cgroup may not be granted more permissions than the cgroup's
52parent has. 50parent has.
51
524. Hierarchy
53
54device cgroups maintain hierarchy by making sure a cgroup never has more
55access permissions than its parent. Every time an entry is written to
56a cgroup's devices.deny file, all its children will have that entry removed
57from their whitelist and all the locally set whitelist entries will be
58re-evaluated. In case one of the locally set whitelist entries would provide
59more access than the cgroup's parent, it'll be removed from the whitelist.
60
61Example:
62 A
63 / \
64 B
65
66 group behavior exceptions
67 A allow "b 8:* rwm", "c 116:1 rw"
68 B deny "c 1:3 rwm", "c 116:2 rwm", "b 3:* rwm"
69
70If a device is denied in group A:
71 # echo "c 116:* r" > A/devices.deny
72it'll propagate down and after revalidating B's entries, the whitelist entry
73"c 116:2 rwm" will be removed:
74
75 group whitelist entries denied devices
76 A all "b 8:* rwm", "c 116:* rw"
77 B "c 1:3 rwm", "b 3:* rwm" all the rest
78
79In case parent's exceptions change and local exceptions are not allowed
80anymore, they'll be deleted.
81
82Notice that new whitelist entries will not be propagated:
83 A
84 / \
85 B
86
87 group whitelist entries denied devices
88 A "c 1:3 rwm", "c 1:5 r" all the rest
89 B "c 1:3 rwm", "c 1:5 r" all the rest
90
91when adding "c *:3 rwm":
92 # echo "c *:3 rwm" >A/devices.allow
93
94the result:
95 group whitelist entries denied devices
96 A "c *:3 rwm", "c 1:5 r" all the rest
97 B "c 1:3 rwm", "c 1:5 r" all the rest
98
99but now it'll be possible to add new entries to B:
100 # echo "c 2:3 rwm" >B/devices.allow
101 # echo "c 50:3 r" >B/devices.allow
102or even
103 # echo "c *:3 rwm" >B/devices.allow
104
105Allowing or denying all by writing 'a' to devices.allow or devices.deny will
106not be possible once the device cgroups has children.
107
1084.1 Hierarchy (internal implementation)
109
110device cgroups is implemented internally using a behavior (ALLOW, DENY) and a
111list of exceptions. The internal state is controlled using the same user
112interface to preserve compatibility with the previous whitelist-only
113implementation. Removal or addition of exceptions that will reduce the access
114to devices will be propagated down the hierarchy.
115For every propagated exception, the effective rules will be re-evaluated based
116on current parent's access rules.