snifs — Safer Native Implemented Functions — gives the BEAM crash-isolated native
interfaces. A normal NIF runs native code inside the VM’s address space, so any
fault (out-of-bounds access, overflow, @panic) kills the entire BEAM VM. A SNIF
keeps the NIF’s interface but compiles the guest to WebAssembly (Zig and Rust
today) and runs it under wasmtime via wasmex, so a guest fault becomes a
catchable {:error, reason} tuple and the calling process survives.
This is a research + reference repository (the SNIF architecture paper, a working BEAM + WASM implementation, integration tests, and formal-verification artifacts) — not a standalone installable application. The fastest way to "use" snifs is to run the demo and watch the BEAM survive a guest crash.
-
just — task runner (install guide)
-
Elixir 1.15+ on OTP 25+ (the precompiled
wasmexnif-2.15artifact loads on OTP 25 through 28) -
Zig 0.15+ — only if you want to rebuild the
.wasmguests yourself (pre-built binaries ship inpriv/)
git clone https://github.com/hyperpolymath/snifs.git
cd snifs/demo
mix deps.get
mix testThe ExUnit suite triggers every guest failure mode — out-of-bounds, @panic,
overflow, divide-by-zero — and asserts that each returns {:error, _} while the
caller process stays alive. That is crash isolation, demonstrated.
just build-wasmAlways built with -OReleaseSafe; ReleaseFast turns the same faults into silent
wrong answers and is kept only as a negative control.
-
Architecture & evidence: EXPLAINME
-
What is proven vs tested vs trusted: PROOF-STATUS
-
Guided tour:
just tour -
Report a problem:
just help-me(pre-fills diagnostic context)
-
Read the README for scope, benchmarks, and the honesty boundary.
-
Read the paper:
docs/whitepapers/academic/snif.pdf(also on Zenodo).