Skip to content

Tags: lowRISC/container-hotplug

Tags

20260810-1

Toggle 20260810-1's commit message
fix: detach cloned sysfs mounts from the host propagation group

`bind_sysfs` clones a device's sysfs directory with `open_tree(OPEN_TREE_CLONE)`,
which is the new-mount-API equivalent of `mount --bind`. Cloning a *shared* mount
yields a peer of the source rather than a private mount, and `/sys` is shared on
a systemd host (`mount --make-rshared /` at boot).

Device syspaths nest inside each other, so the clone for a device ends up being
the parent mount of the clones for its children. Mounting under a shared mount
propagates the new mount to every peer of the group, which includes the host's
own `/sys`. Those copies live in the host's mount namespace, so unlike the
container's own mounts they survive the container exiting, and `unbind_sysfs`
does not reach them -- it acts inside the container's namespace, and only when a
device is unplugged.

On a CI machine where the boards stay plugged in and containers come and go,
the host's mount table therefore grows by roughly one entry per device per
container start. One host reached ~98000 of the default `fs.mount-max` of
100000, past which every mount attempt failed:

    Cannot make sysfs writable: Cannot mount sysfs directory
    /sys/devices/.../usb7/7-2/7-2.4/7-2.4.1/7-2.4.1.1:
    No space left on device (os error 28)

Devices still attached and the container still started, so this degraded
silently until a job tried to write a sysfs attribute.

Make the detached clone private before attaching it. Verified with the same
syscall sequence that the clone goes from `private,slave master:12` (the
propagation group of `/sys`) to `private`, and that a mount made underneath it
then creates one mount rather than one per peer.

Nothing is lost by this: sysfs device directories are dentries within a single
superblock rather than submounts, so nothing under `/sys/devices` relies on
propagation to become visible.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

20260727-1

Toggle 20260727-1's commit message
ci: add github pages deployement of the rustdocs

Signed-off-by: David James McCorrie <james.mccorrie@lowrisc.org>

20251118-1

Toggle 20251118-1's commit message
chore: update cgroup_device_filters deps

20250409-1

Toggle 20250409-1's commit message
Propagate udev messages into the container

By default, in terms of kobject uevent messages, containers will:
* Without userns: see kernel messages but not udev messages
* With userns: see no messages at all

And this creates trouble for libraries such as libusb, which relies on these
netlink messages to detect device updates.

We fix this by filling the gap for systemd and send out our own udev messages.

20241201-1

Toggle 20241201-1's commit message
Remove systemd's device filter configuration if any

We remove systemd's filter but it might be added back by systemd if we
don't get rid of these config completely.

20241011-1

Toggle 20241011-1's commit message
Support block devices

20241008-1

Toggle 20241008-1's commit message
Remount /dev when user namespace is used to allow accessing device nodes

20241004-1

Toggle 20241004-1's commit message
Implement ID map parsing and translation

20240513-1

Toggle 20240513-1's commit message
Fix cgroup.events error when cgroup is gone before reading events

If cgroup is gone before reading the cgroup.events file then it will return
an error. Treat errors as unpopulated to account for it.

20240426-1

Toggle 20240426-1's commit message
Apply README suggestions from code review

Co-authored-by: James Wainwright <james.wainwright@lowrisc.org>