Mova0.5 pre-release⌕
☰
home / docs / vfs — file system for the execution sandbox

vfs — file system for the execution sandbox

Prototype. This is an experiment beside Mova, not part of its core yet: it works and is measured, but its interfaces and data may change at any time.

Goal (Smart annotator — layers, context, memory, "Execution sandbox"): guest programs, including untrusted and generated code, see only virtual files in memory. Only an approved result goes outside. Every SLM (small language model) lesson starts from a clean snapshot in nanoseconds. WASM/WASI guests reach the same file system through wasi-host.

A crate without dependencies, std only. Three implementations of the FileSystem trait:

typewhat it iswhen
Vfsin-memory tree with snapshots, limits, a journal and a virtual clockdefault: untrusted and generated code (--fs mem)
DirFsa real directory, the root is the boundary (like chroot)working with operator data (--fs dir:<dir>)
RealFsunrestricted real FSexplicit only (--fs real)

Alongside it — wasi-host: runs wasm32-wasip1 modules (like mlab.wasm), and their WASI calls go into the same Vfs (see "WASI host" below).

What Vfs can do

DirFs — a real directory with a confined root

Negative controls

A gate that cannot show red is not a gate. Vfs::fault and DirFs::fault deliberately break the implementation, and the test gates_green_and_negative_controls_red requires: without the fault — green, with the fault — red.

faultgatered
ClampDotDot: .. above the root silently stays at the rootroot escape (Vfs, DirFs)yes
NoLimits: limits are not checkedlimitsyes
RestoreForgetsClock: restore does not roll back the clocksnapshot → byte-exact restoreyes
NoConfine: DirFs without the canonical path checklinks pointing outsideyes

Snapshot speed (release, nice, one thread)

cargo run --release --example snapbench: N files of 1 KiB in directories of 1000 plus a 64 MiB file.

filessize, MiBsnapshotrestorelesson: restore + write 1 filefirst appended byte to a shared 64 MiB filefull dump()
1 0006519 ns20 ns34 µs16 ms10 ms
10 0007420 ns18 ns34 µs10 ms31 ms
100 00016220 ns20 ns37 µs9 ms62 ms

Tests

cargo test: 16 tests.

WASI host (wasi-host)

Runs wasm32-wasip1 modules in a sandbox. For the emulated code it looks like a real machine, for us it is fully reproducible.

cd mlab && cargo build --release --target wasm32-wasip1        # mlab.wasm
cd ../wasi-host && cargo build --release
../target/release/wasi-run [--fs-import DIR[:VIRT]]… [--fs-export DIR[:VIRT]]… [--fs-limits …] [--seed N] \
    [--fuel N] [--mem-limit 1G] [--journal j.tsv] [--stats] ../target/wasm32-wasip1/release/mlab.wasm \
    -e "writematrix(magic(4), '/tmp/m.csv'); disp(readdir('/tmp'))" --fs real
cargo run --release --example mlab_gate -- ../mlab/data/suite-fs.txt [--vm]    # gate with per-scenario timing

--fs real in the guest means: the guest's std::fs → WASI calls → the host's Vfs. Without it, mlab in the guest uses its own Vfs inside the module, i.e. a double sandbox.

WASI gate (cargo test in wasi-host, 12 tests)

Licenses

What next

Licence

Elamur Cosmic License (Elamur Cosmic License). Third-party data keeps its own terms, as noted where it is used.

This page in Markdown → https://md.mova.elamur.ai/free/en/docs/vfs/