jailer: pivot_root does not work with rootfs
Per the comment in the syscall code, SYS_pivot_root will fail if the current root is rootfs. This is a problem for systems that do not mount anything over the rootfs.
Hello! My name's Dhriti, I'm currently taking the CS 360V course at UT Austin. One of our projects for the class is to work on an issue in an open-source repository, and since I've been working on learning Rust recently, this repository looked pretty cool. Would it be alright if I worked on this issue? If so, I'd really appreciate any information on how to approach it, or where to get started.
- When switching another root device, initrd would pivot_root and then
umount the ramdisk. But initramfs is rootfs: you can neither pivot_root
rootfs, nor unmount it. Instead delete everything out of rootfs to
free up the space (find -xdev / -exec rm '{}' ';'), overmount rootfs
with the new root (cd /newmount; mount --move . /; chroot .), attach
stdin/stdout/stderr to the new /dev/console, and exec the new init.
Solving this is not trivial and requires changing from pivot_root to mount(MS_MOVE) in cases where / is rootfs (initramfs). We're not aware of any usecases where firecracker is run directly from an initramfs, so we're going to close this issue as not relevant,