Skip to content

fix(hyperrs-fs): tear down any jail tree a hostile VMM can build - #167

Merged
markovejnovic merged 6 commits into
mainfrom
fix/fs-hostile-jail-teardown
Nov 16, 2026
Merged

markovejnovic merged 6 commits into
mainfrom
fix/fs-hostile-jail-teardown

Conversation

@markovejnovic

@markovejnovic markovejnovic commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

A FIFO opened as a regular file or device blocked before the type check
ran, so FileLock::acquire ignored its timeout with a FIFO at the lock
name. A refused O_TRUNC open still truncated and a refused O_CREAT open
left a new file. Probe with O_PATH, validate, then reopen with the real
flags; create only with O_EXCL, and only for types a create can yield.
The jail root is owned by the jail uid, so Firecracker can create any
name in it. entries() rejected every name that was not a StrictComponent
(whitespace included) with EINVAL, and rmdirat_recursive held one fd
per level, so a name like 'a b' or a tree deeper than RLIMIT_NOFILE made
JailLayout::remove fail on every retry and leaked the jail.

entries() now yields a LooseComponent (no '/', NUL, '.' or '..'), and
rmdirat_recursive walks iteratively holding no fd per level, climbing
through '..' only when it is the recorded parent inode.
@codecov

codecov Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.97590% with 10 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
native/hyperrs-fs/src/path.rs 84.78% 7 Missing ⚠️
native/hyperrs-fs/src/dir.rs 94.91% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Test Results

    4 files  ±  0    261 suites  +20   3m 23s ⏱️ +13s
1 234 tests + 69  1 234 ✅ +69    0 💤 ± 0  0 ❌ ±0 
1 784 runs  +112  1 234 ✅ +69  550 💤 +43  0 ❌ ±0 

Results for commit 5fe1e3f. ± Comparison against base commit e2764c3.

This pull request removes 2 and adds 71 tests. Note that renamed tests count towards both.
Elixir.Hyper.Grpc.CodecTest ‑ test to_grpc/1 response encoding a created result carries the vm_id and node string
Elixir.Hyper.Node.FireVMM.AgentHostileTest ‑ test a hostile reply ends the call within the deadline as an error, and closes the connection
Elixir.Hyper.Grpc.CodecTest ‑ test from_grpc/1 LoadImageRequest an exec request needs an argv
Elixir.Hyper.Grpc.CodecTest ‑ test from_grpc/1 LoadImageRequest an exec request passes its timeout only when set
Elixir.Hyper.Grpc.CodecTest ‑ test to_grpc/1 response encoding a created result carries the vm_id, node string and IPv6 address
Elixir.Hyper.Grpc.CodecTest ‑ test to_grpc/1 response encoding an executed result carries the exit code and both streams
Elixir.Hyper.Grpc.CodecWirePropertiesTest ‑ property a cmdline carrying any byte outside printable ASCII, or a quote, is refused
Elixir.Hyper.Grpc.CodecWirePropertiesTest ‑ property a port rule is accepted exactly when its protocol and ascending range are valid
Elixir.Hyper.Grpc.CodecWirePropertiesTest ‑ property an unrecognised error reason is INTERNAL with a fixed message
Elixir.Hyper.Grpc.CodecWirePropertiesTest ‑ property appending a reserved argument to any accepted cmdline makes it refused
Elixir.Hyper.Grpc.CodecWirePropertiesTest ‑ property every instance_type/arch integer decodes or is refused with its specific reason
Elixir.Hyper.Grpc.CodecWirePropertiesTest ‑ test a direction of 128 rules is accepted and 129 is refused
…

♻️ This comment has been updated with latest results.

…ecks

Pin close-on-exec on every open route, that a directory id is stable
across paths and distinct between directories, and that a NUL byte is
refused in strict and loose components. Exclude the equivalent | -> ^
open-flag mutants, whose operands never share a bit.
check_component took an allow_whitespace bool and returned (), so every
caller validated and then cast through new_unchecked. Each component type
now owns a const from_bytes returning &Self, and StrictComponent refines a
parsed ComponentWithWhitespace.

Structural errors now win over whitespace: " a/b" is Separator, not
Whitespace.
@markovejnovic
markovejnovic marked this pull request as ready for review November 16, 2026 02:45
@markovejnovic
markovejnovic merged commit be95f82 into main Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant