Repository navigation
fix(fire_vmm): harden Firecracker binary/kernel staging and the API transport - #171
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Test Results 4 files ± 0 346 suites +10 4m 34s ⏱️ +36s Results for commit c570bd5. ± Comparison against base commit a9da789. This pull request removes 3 and adds 44 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
markovejnovic
marked this pull request as ready for review
November 15, 2026 22:30
markovejnovic
force-pushed
the
fix/firecracker-trust-and-transport
branch
from
November 16, 2026 02:56
6b88ee9 to
386f20e
Compare
… stage set-id KernelImage::open opened the source O_RDONLY before checking its type, so a FIFO with no writer hung the helper. Vet it through an O_PATH fd first, then reopen for reading. A set-id root-owned source was hard-linked into the jail as root, handing the jail a set-id inode protected_hardlinks would refuse; such a source is now always copied at KERNEL_MODE.
… rewrite The jailer is handed Firecracker by path and canonicalizes and copies it itself, so vetting the file alone left a window: whoever can write a parent directory could rename another file over the vetted path. RootSafeBinPathBuf now also requires every directory above the binary to be root-owned and not group/other-writable (sticky directories excepted), checked from / down. The provisioning script and firecracker.install's printed steps chown the install directory to root accordingly.
Req/Mint buffered response headers without limit and reset receive_timeout
on every chunk, so a compromised Firecracker could make the node buffer
unbounded headers or hold a call past Client.run/2's 35 s cap. The transport
now speaks HTTP/1.1 over the socket itself: 8 KiB per head line, at most 100
headers or trailers, the 1 MiB body cap, and one 30 s deadline for the call.
A typed 2xx reply that is not a JSON object is {:error, {:unexpected_body, _}}
instead of {:ok, raw}, which crashed AwaitingApi.
The helper canonicalizes the kernel path before vetting it, but the boot check lstat-ed the link itself and refused every symlinked kernel the first launch would have accepted.
A chain of individually in-tree symlinks (s -> ., t -> s/..) followed by an entry through it spun :erl_tar.extract/2 forever. The pinned Firecracker releases ship no symlinks, so any symlink entry is refused up front.
…t root Stage set-id kernels as the caller too, pin that a plain kernel is hard-linked on one filesystem, and prove RootSafeBinPathBuf passes / and sticky /tmp and refuses at the first caller-owned parent. Exclude the equivalent disjoint-bit `|` -> `^` mutants and the `|` -> `&` one only a root-owned writable parent can tell apart.
Replace the lstat-based root_only_writable validator with an openat descent
from `/` through SafeFile<IsDirectory, RootOwner, StickyOrOwnerOnlyWritable>,
so each parent is checked on the fd the next lookup resolves from. Fold
ParentStat/UnsafeParent into Parent { source: file::ValidationError }.
Kills the three surviving check mutants (Ok(()), & -> |, & -> ^) by opening real directories at each mode as the unprivileged caller.
…once
- RootSafeBin{,PathBuf}::open take &SafePath<IsAbsolute, StrictComponents>;
[tools] paths deserialize as SafePathBuf, so a loose path fails at config
load. Drops the strict(), required() and default_work_dir() helpers and the
safe_path deserializer.
- The parent walk moves to SafeFile::<IsDirectory, R, O>::open_parent, which
reports the failing directory as ParentError.
- RootSafeBinError is { path, kind } with #[from] kinds, so the checks use
plain ? instead of per-call error closures.
markovejnovic
force-pushed
the
fix/firecracker-trust-and-transport
branch
from
November 16, 2026 04:50
9601f32 to
c570bd5
Compare
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.
No description provided.