Repository navigation
Conversation
…fctl/802-firecracker-jailer
…ge-caches-builds' into fctl/802-firecracker-jailer
This was referenced Nov 6, 2026
This comment has been minimized.
This comment has been minimized.
…at the jailer needs The jail's user owns its chroot, so the host now links Firecracker's sockets out of it by inode, each opened without following a link and checked to be a socket, rather than reaching them through it. Writable disks lent to a jail are noted beside the chroot and given back as the VM stops, and jails of VMs that don't run go before the next VM starts. A jail's uid is picked under a lock that other processes take too. Kernels and initramfses are put in a jail through links to the files they name, and copied where they're private. The driver isn't ready without cgroup v2, on a nodev filesystem, or without a jailer beside a named Firecracker, which may be named as the release names it.
This comment has been minimized.
This comment has been minimized.
Hard links can't cross filesystems, and the host's socket directory is in /tmp: the links now go in a directory of root's beside the chroot, which the socket directory leads to. The root boot test checks that the sandbox's disk and the images' filesystems are the host's once their VMs stop.
Contributor
Author
|
On the review's summary finding (a crashed unpack VM's jail and cgroup are never removed): fixed in d3cd28e. Before each VM starts (a sandbox's or an unpack VM's), the driver removes jails that no running VM has and that are older than ten minutes (older than any start): it gives back the disks their |
kalaspuff
approved these changes
Nov 6, 2026
fctl-sh Bot
added a commit
that referenced
this pull request
Nov 6, 2026
… a jailed VM's caches in its jail #429, this branch's base, was squash-merged into main with #434, the jailer: the tree is main's with this pull request's own changes applied again. A jailed VM's Firecracker connects to the cache server from its chroot, as the jail's user, so the server now listens there on a socket given to that user; CI's root step runs the caches test, jailed.
fctl-sh Bot
added a commit
that referenced
this pull request
Nov 6, 2026
…ate for jailed VMs #429, this branch's base, was squash-merged into main with #434, the jailer: the tree is main's with this pull request's own changes applied again. A jailed Firecracker would write its state in its chroot, which goes as the VM stops, and a restore would need the jail made again around it, so a jailed VM stops without saving and boots from its disk, as before; a state saved before the host ran as root goes. The snapshot test runs without the jailer, and the root boot test checks that a jailed stop saves nothing.
This was referenced Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A host that runs as root now runs each Firecracker VM through Firecracker's jailer, so that a VM escape lands as a user of its own in a chroot rather than as the host's user, who can read the runner's token. Each VM gets a uid and gid of its own (from 1,900,000,000 up, picked under a lock so that no other running VM's jail has it), a chroot under
firecracker/jail/, and a cgroup of its own (fctl/<VM key>, at most 256 processes):host.tomlnames (asjaileror as the release names it). It needs cgroup v2 and a data directory on a filesystem that allows device files; without either, or without a jailer, the driver reports itself not ready with what to change.jailer = falsein[firecracker]turns it off, and hosts that don't run as root are unchanged.I verified it in Firecracker nested in a QEMU VM on aarch64:
boots_a_sandboxas root passes with both Ubuntu 24.04's passt and Debian 13's, checks that Firecracker runs as a jail's user, and that the sandbox's disk and the images' filesystems are root's again once their VMs stop. CI's root step runs it jailed on x86_64, and runs the stale-jail test as root, where it lends and takes back a disk. Unit tests cover the jail's users, the jailer's arguments and where it's found, the chroot's links and copies, linking only the jail's own sockets, and removing stale jails. The docs (security, architecture,host.toml, ADR 0070's consequences) say what a jailed VM can reach.Worth confirming
jailer = falseturns it off, and a root host without cgroup v2 must set it to run VMs at all./etc/passwd, chosen far from the ranges people, system users and user namespaces take.nobody(passt drops to it itself when started as root), rather than as the jail's user.Refs #345
fctl session
Warning
High risk. It changes how every Firecracker VM starts on hosts that run as root, on by default, and it chowns disks and creates uids, chroots, links and cgroups on the host, so a mistake could stop VMs from booting or weaken the isolation it sets out to add.
What it does. On hosts that run as root, each Firecracker VM now starts through Firecracker's jailer as its own uid and gid in a chroot and cgroup, so that a VM escape no longer lands as the host's user. The jailer comes with the pinned Firecracker or from beside a configured one, and
jailer = falsein[firecracker]turns it off. The host links the VM's sockets, after checking them, into a root-owned directory beside the chroot that the VM's socket directory leads to, hands writable disks back when a jail ends, picks uids under a lock, and removes stale jails. Since the last review, the stale-jail test also lends a disk to a jail uid when run as root, and CI runs it as root.On by default. The jailer is on for every host running as root unless
jailer = false; it needs cgroup v2 and a data directory not mountednodev, and package caches and snapshots don't yet work with jailed VMs.fctl review's first look at
6dca881· 9 files, +856 −36 · Review agent settings