Skip to content

Commit 5a7ee3a

Browse files
committed
config-linux: RFC 2119 wording for linux.resources.devices
Since ce55de2 (Remove range limit which depend on kernel, 2017-04-26, #780), the spec has been more aggressively punting to the kernel APIs (vs. carrying local versions of kernel limitations). For the properties touched by this commit, a pull request to reflect our old valid values (e.g. requiring 'type' to match ^[acb]$) was rejected as part of this punting approach. However, before this commit, it wasn't clear exactly what kernel interface was being punted to. With this commit, we replace the old inline docs with an explicit punt to the device whitelist controller, listing the exact actions that the runtime MUST take for given config values. This allows for compliance-testing runtimes [2] (ensuring config portability between compliant runtimes) and makes it possible to validate a given config against a given kernel (e.g. Linux 4.11.1 only accepts 'a', 'b', and 'c' as type characters [3]). [1]: #690 (comment) [2]: #746 [3]: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/security/device_cgroup.c?h=v4.11.1#n618 Signed-off-by: W. Trevor King <[email protected]>
1 parent f79b61d commit 5a7ee3a

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

config-linux.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,21 +211,30 @@ Runtimes MAY attach the container process to additional cgroup controllers beyon
211211

212212
### <a name="configLinuxDeviceWhitelist" />Device whitelist
213213

214-
**`devices`** (array of objects, OPTIONAL) configures the [device whitelist][cgroup-v1-devices].
215-
The runtime MUST apply entries in the listed order.
214+
**`devices`** (array of objects, OPTIONAL) configures the [device whitelist controller][cgroup-v1-devices] at [`cgroupsPath`](#control-groups).
216215

217216
Each entry has the following structure:
218217

219218
* **`allow`** *(boolean, REQUIRED)* - whether the entry is allowed or denied.
220-
* **`type`** *(string, OPTIONAL)* - type of device: `a` (all), `c` (char), or `b` (block).
221-
Unset values mean "all", mapping to `a`.
219+
The line for this entry is:
220+
221+
> {type} {major}:{minor} {access}
222+
223+
When true, the runtime MUST write that to `devices.allow`.
224+
When false, the runtime MUST write that line to `devices.deny`.
225+
* **`type`** *(string, OPTIONAL)* - type of device.
226+
Defaults to `a`.
222227
* **`major, minor`** *(int64, OPTIONAL)* - [major, minor numbers][devices] for the device.
223-
Unset values mean "all", mapping to [`*` in the filesystem API][cgroup-v1-devices].
228+
Defaults to `*`.
224229
* **`access`** *(string, OPTIONAL)* - cgroup permissions for device.
225-
A composition of `r` (read), `w` (write), and `m` (mknod).
230+
Defaults to `rwm`.
231+
232+
The runtime MUST NOT write any other lines to either `devices.allow` or `devices.deny`.
226233

227234
#### Example
228235

236+
The configuration:
237+
229238
```json
230239
"devices": [
231240
{
@@ -249,6 +258,12 @@ Each entry has the following structure:
249258
]
250259
```
251260

261+
would result in the runtime writting the following lines:
262+
263+
* `a *:* rwm` to `devices.deny`
264+
* `c 10:229 rw` to `devices.allow`
265+
* `b 8:0 r` to `devices.allow`
266+
252267
### <a name="configLinuxDisableOutOfMemoryKiller" />Disable out-of-memory killer
253268

254269
`disableOOMKiller` contains a boolean (`true` or `false`) that enables or disables the Out of Memory killer for a cgroup.

0 commit comments

Comments
 (0)