On 7/13/26 05:39, Alyssa Ross wrote: > Demi Marie Obenour writes: > >> cgroup-setup is written in Rust and uses the Rust standard library. >> It also relies on cgroupfs being mounted at /sys/fs/cgroup. >> Furthermore, it runs very, *very* early on, since it sets up the cgroups >> in which s6-svscan and s6-supervise processes run. This allows setting >> up sub-cgroups without having to worry about name collisions. >> >> While it would be possible to only mount the bare minimum necessary, >> it's simpler to just mount everything before starting any services. >> These mounts are all pseudo-filesystems or tmpfs instances, and none >> have any dependencies. >> >> Signed-off-by: Demi Marie Obenour >> --- >> host/rootfs/image/etc/init | 11 ++++++++++- >> host/rootfs/image/etc/s6-linux-init/scripts/rc.init | 9 +-------- >> 2 files changed, 11 insertions(+), 9 deletions(-) >> >> diff --git a/host/rootfs/image/etc/init b/host/rootfs/image/etc/init >> index db8a6d9c747e3d212c21b6c983c8f7e299822abe..8ec7859ab00e24007a93d4000c8f34e353de50ae 100755 >> --- a/host/rootfs/image/etc/init >> +++ b/host/rootfs/image/etc/init >> @@ -1,6 +1,15 @@ >> #!/bin/execlineb -Ws0 >> # SPDX-License-Identifier: EUPL-1.2+ >> -# SPDX-FileCopyrightText: 2022 Alyssa Ross >> +# SPDX-FileCopyrightText: 2020-2022, 2024 Alyssa Ross >> >> /bin/setpriv --no-new-privs -- >> + >> +if { /bin/ln -s /proc/self/fd /dev } >> +if { /bin/ln -s /proc/self/fd/0 /dev/stdin } >> +if { /bin/ln -s /proc/self/fd/1 /dev/stdout } >> +if { /bin/ln -s /proc/self/fd/2 /dev/stderr } > > I guess the idea is that the Rust standard library might want these? I don't know if it actually does, though I would not be surprised if it is not tested without them. What *is* necessary is for a cgroup filesystem to be mounted at /sys/fs/cgroup. This allows setting up cgroup controllers and moving PID 1 to a sub-cgroup. >> + >> +if { /bin/mount --make-shared / } >> +if { /bin/mount -a --mkdir } >> + >> /bin/s6-linux-init -c /etc/s6-linux-init -s /run/param -- $@ >> diff --git a/host/rootfs/image/etc/s6-linux-init/scripts/rc.init b/host/rootfs/image/etc/s6-linux-init/scripts/rc.init >> index f638e373589884acb959c868462fdf532380a851..fba305c4e9cbb9f7535f11bb4c06d8da8a34837b 100755 >> --- a/host/rootfs/image/etc/s6-linux-init/scripts/rc.init >> +++ b/host/rootfs/image/etc/s6-linux-init/scripts/rc.init >> @@ -4,13 +4,6 @@ >> >> if { s6-rc-init -c /etc/s6-rc /run/service } >> >> -if { ln -s /proc/self/fd /dev } >> -if { ln -s /proc/self/fd/0 /dev/stdin } >> -if { ln -s /proc/self/fd/1 /dev/stdout } >> -if { ln -s /proc/self/fd/2 /dev/stderr } >> - >> -if { mount --make-shared / } >> -if { mount --make-shared /run } >> -if { mount -a --mkdir } >> +if { /bin/mount --make-shared /run } > > Presumably this does not actually suddenly need an absolute path. You are correct. >> >> s6-rc change ok-all -- Sincerely, Demi Marie Obenour (she/her/hers)