From 3db728262f7f7e4defb2a60d95561c77ea852f14 Mon Sep 17 00:00:00 2001 From: "fctl-sh[bot]" <343971779+fctl-sh[bot]@users.noreply.github.com> Date: Fri, 6 Nov 2026 19:03:26 +0000 Subject: [PATCH] feat: give the Firecracker kernel 9p, for fctl's package caches fctl's Firecracker sandboxes got no package caches: Firecracker has no virtio-fs or virtio-9p, so the VMs share no filesystem with the host. fctl's host now serves a project's caches over 9P2000.L on each VM's vsock, and fctl-agent mounts that connection with the kernel's 9p client (trans=fd). The kernel gets 9p and its fd transport, as 6.18.59-1, and kernel/check.sh checks both. Refs hyperstructure/fctl#345 --- AGENTS.md | 3 ++- README.md | 13 ++++++++----- kernel/VERSION | 2 +- kernel/check.sh | 15 +++++++++++---- kernel/fctl.config | 8 ++++++++ 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index b172755..2e976af 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -80,7 +80,8 @@ pull request. `ghcr.io/hyperstructure/sandbox-kernel:`, the version each fctl release pins, and boots the file `/vmlinux` in it: an uncompressed kernel (x86_64's ELF `vmlinux`, aarch64's `Image`) with everything built in, and - with ext4, overlayfs, virtio's MMIO devices, vsock and TAP devices, which + with ext4, overlayfs, virtio's MMIO devices, vsock, TAP devices and 9p + with its fd transport (for the package caches, from `6.18.59-1`), which its init needs (`kernel/check.sh` checks them). Publish a tag before fctl pins it. A tag never moves (the Kernel workflow builds no published version again): a change to how the kernel is built takes a new version diff --git a/README.md b/README.md index e840d30..62d40ab 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,7 @@ fctl's `firecracker` driver runs each session in a image, which boots a kernel published from here too: ```sh -docker buildx imagetools inspect ghcr.io/hyperstructure/sandbox-kernel:6.18.59 +docker buildx imagetools inspect ghcr.io/hyperstructure/sandbox-kernel:6.18.59-1 ``` It is Linux's long-term release in [`kernel/VERSION`](kernel/VERSION), @@ -201,13 +201,16 @@ configured as Firecracker configures its own CI's guests [`kernel/microvm-aarch64.config`](kernel/microvm-aarch64.config), from Firecracker's `resources/guest_configs`): every driver built in, with ext4, overlayfs, vsock, TAP devices, cgroups, nftables and the balloon's free -page reporting. [`kernel/fctl.config`](kernel/fctl.config) adds only -`/proc/config.gz`. The image holds the kernel as `/vmlinux`, and its -configuration as `/vmlinux.config`. +page reporting. [`kernel/fctl.config`](kernel/fctl.config) adds +`/proc/config.gz`, and 9p with its fd transport, with which a sandbox +mounts its project's package caches over the VM's vsock (Firecracker has +no virtio-fs or virtio-9p). The image holds the kernel as `/vmlinux`, and +its configuration as `/vmlinux.config`. | Tag | Kernel | |---|---| -| `6.18.59` | Linux 6.18.59. Each fctl release pins the one its hosts boot. A tag never moves: a change to how the kernel is built takes a new one, `6.18.59-2` for the same release. | +| `6.18.59-1` | Linux 6.18.59 with 9p, for the package caches. Each fctl release pins the one its hosts boot. A tag never moves: a change to how the kernel is built takes a new one, `6.18.59-2` for the same release. | +| `6.18.59` | Linux 6.18.59, without 9p: the one fctl pinned before. | | `6.18` | The newest 6.18 built here. | ```sh diff --git a/kernel/VERSION b/kernel/VERSION index ed16a90..d258524 100644 --- a/kernel/VERSION +++ b/kernel/VERSION @@ -1 +1 @@ -6.18.59 +6.18.59-1 diff --git a/kernel/check.sh b/kernel/check.sh index 295ffae..9f01ee8 100755 --- a/kernel/check.sh +++ b/kernel/check.sh @@ -2,9 +2,9 @@ # Boots the kernel at $1 in Firecracker, as fctl's firecracker driver boots # its sandboxes (an initramfs, a drive, a vsock), and checks that it reaches # userspace with what fctl-agent's init needs: virtio's MMIO devices, its -# drive mounted as ext4 with an overlay on it, vsock's transport and TAP -# devices. Needs /dev/kvm and mkfs.ext4; without KVM, says so and checks -# nothing. +# drive mounted as ext4 with an overlay on it, vsock's transport, TAP +# devices and 9p with its fd transport. Needs /dev/kvm and mkfs.ext4; +# without KVM, says so and checks nothing. set -euo pipefail kernel=$(realpath "$1") @@ -61,6 +61,13 @@ grep -q hello /merged/hello 2>/dev/null || missing "the drive's file through the ls /sys/bus/virtio/drivers/vmw_vsock_virtio_transport 2>/dev/null | grep -q virtio || missing "vsock's virtio transport" [ -e /dev/net/tun ] || missing /dev/net/tun +# 9p and its fd transport, with which the VM mounts the package caches the +# host serves over its vsock. A mount over /dev/null fails, but without the +# transport the kernel says it can't find it. +grep -qw 9p /proc/filesystems || missing 9p +mkdir -p /share +mount -t 9p -o trans=fd,rfdno=0,wfdno=1 none /share /dev/null 2>&1 +dmesg | grep -q "Could not find request transport" && missing "9p's fd transport" echo "fctl-kernel: booted $(uname -r)" reboot -f INIT @@ -89,4 +96,4 @@ if grep -q "fctl-kernel: no" console.log; then echo "The kernel lacks what fctl-agent's init needs." >&2 exit 1 fi -echo "Booted in Firecracker $firecracker_version: a drive with ext4 and an overlay on it, vsock's transport and TAP devices work." +echo "Booted in Firecracker $firecracker_version: a drive with ext4 and an overlay on it, vsock's transport, TAP devices and 9p's fd transport work." diff --git a/kernel/fctl.config b/kernel/fctl.config index 1f59651..7e78305 100644 --- a/kernel/fctl.config +++ b/kernel/fctl.config @@ -4,3 +4,11 @@ # know what their sandbox's kernel can do. CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y + +# 9p over a file descriptor (trans=fd), for the package caches a project's +# sandboxes share: the host serves them over the VM's vsock, and fctl-agent +# mounts the connection at /var/cache/fctl. Firecracker has no virtio-fs or +# virtio-9p. +CONFIG_NET_9P=y +CONFIG_NET_9P_FD=y +CONFIG_9P_FS=y