cgroup-setup, a tool which will be introduced in a later patch, 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 <demiobenour@gmail.com> Reviewed-by: Alyssa Ross <hi@alyssa.is> --- host/rootfs/image/etc/init | 11 ++++++++++- host/rootfs/image/etc/s6-linux-init/scripts/rc.init | 7 ------- 2 files changed, 10 insertions(+), 8 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 <hi@alyssa.is> +# SPDX-FileCopyrightText: 2020-2022, 2024 Alyssa Ross <hi@alyssa.is> /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 } + +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..db766ba0ca0a11982f5b55497c17eaf5e95afb2c 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 } s6-rc change ok-all -- 2.55.0