Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RFC] Implement systemd-specific per-cgroup support, add it to "devic…
…es" cgroup This PR is trying to accomplish two things: 1. Define a new interface that will allow subsystems/controllers to implement systemd-based configuration, by using systemd directives rather than writing directly to the cgroup subtree. 2. Add a systemd-based implementation to the "devices" subsystem, to illustrate how it is meant to be used. The initial point I'd like to make here is towards discussing (1) as an idea and whether the Go abstractions/interfaces are appropriate here or whether we should move things around. Consider part (2) to be really a draft and not really finished (even though it actually works to a large extent, the D-Bus messages are correct and that has been tested to do what's expected.) I tested this with Podman using: $ podman --runtime ~/go/src/github.com/opencontainers/runc/runc run -t fedora:29 echo hello And also bringing up a container and checking the contents of "device.list" in the cgroup subtree: $ podman --runtime ~/go/src/github.com/opencontainers/runc/runc run -t fedora:29 sleep 1h $ cat /sys/fs/cgroup/devices/machine.slice/libpod-12fc7bd62fd6*/devices.list c 10:200 rwm c 5:2 rwm c 136:* rwm c 5:1 rwm c 1:9 rwm c 1:5 rwm c 5:0 rwm c 1:7 rwm c 1:8 rwm c 1:3 rwm b *:* m c *:* m This matches the output of devices.list when using the official "runc" binary, only difference being the lines are inverted in order (again, we can fix that on a second step.) Querying systemd for this unit also works as expected: $ systemctl show libpod-12fc7bd62fd66ff62fa1b045c2d717c7b2076c072c20de14f5c1ad86b78865eb.scope -p DevicePolicy -p DeviceAllow DevicePolicy=strict DeviceAllow=/dev/net/tun rwm DeviceAllow=/dev/ptmx rwm DeviceAllow=char-136 rwm DeviceAllow=/dev/console rwm DeviceAllow=/dev/urandom rwm DeviceAllow=/dev/zero rwm DeviceAllow=/dev/tty rwm DeviceAllow=/dev/full rwm DeviceAllow=/dev/random rwm DeviceAllow=/dev/null rwm DeviceAllow=block-* m DeviceAllow=char-* m Signed-off-by: Filipe Brandenburger <filbranden@google.com>
- Loading branch information