You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
Wires the SNIFS build-mode invariant into CI, hardens the `crash_oob`
demonstration so its failure mode is unambiguous, and removes the
committed stale wasm artifacts that quietly drift from source.
The SNIFS isolation guarantee depends on a precondition the build hadn't
been gating: that the shipped wasm guest was compiled with
`-OReleaseSafe`, not `-OReleaseFast`. Build-mode itself was already
locked at source level (`zig/build.zig` hardcodes `.optimize` per
artifact; `Justfile build-wasm` passes `-OReleaseSafe`/`-OReleaseFast`
literally per recipe). The gap was on the test side — no CI job ever ran
the demo suite against the built artifacts.
## Five fixes, all serving the same property
1. **`.github/workflows/e2e.yml`** — replace template stubs with a
concrete job: setup-zig 0.15.0 → `just build-wasm` (both modes, fresh) →
setup-beam OTP 28 / Elixir 1.18 → `mix test --trace`. **Two action SHA
pins inherited from the template were fabricated** (`gh api` → 422):
- `goto-bus-stop/setup-zig@7ab2955...3608` was fake (first 16 hex
collide with v2.2.0's real SHA `7ab2955...2802d`, rest fabricated).
Replaced with v2.2.1 = `abea47f85e598557f500fa1fd2ab7464fcb39406`.
- `erlef/setup-beam@5a67e1a...a66c07` had no resemblance to any release.
Replaced with v1.24.0 = `fc68ffb90438ef2936bbb3251622353b3dcb2f93`.
The same fake pins propagated from `rsr-template-repo` into ~35 other
estate workflows (10 with active uncommented pins). Follow-up PRs to
`rsr-template-repo` + the 3 affected repos
(`odds-and-sods-package-manager`, `proven`, `proven-servers`) coming
separately.
2. **`demo/test/snif_demo_test.exs` paths** — `@safe`/`@fast` were
`__DIR__/../priv/...` resolving to `demo/priv/` (doesn't exist); files
live at top-level `priv/`. Fixed to `__DIR__/../../priv/...`. The suite
couldn't find its fixtures since the binaries were first committed on
2026-05-21 — never run successfully.
3. **`zig/src/safe_nif.zig` `crash_oob` hardening** — previously the
ReleaseFast result was "returns 0 silently," ambiguous between "load was
DCE'd" and "read 0 from adjacent memory." Replaced the function-local
`const` array with a layout-pinned `extern struct { arr: [3]i32, canary:
i32 }` at module scope; `runtime_index = 3` indexes one past the end.
Under ReleaseSafe the bounds check fires; under ReleaseFast the load
deterministically lands on `canary = 0x0BADF00D`, returning
`195_948_557` — a recognisable wrong answer that proves silent
corruption is real, not an artifact of DCE.
4. **`demo/test/snif_demo_test.exs` assertion tightened** — from `assert
{:ok, _}` to `assert {:ok, [195_948_557]}`. A drift in this value means
either Zig data-segment layout changed or — worse — the ReleaseFast
artifact regained safety checks. Either should surface visibly, not pass
silently.
5. **`priv/*.wasm` + `.gitignore` + `Justfile`** — committed wasm
artifacts go stale the moment any zig source changes (which this PR
does), so a local `mix test` against them would fail with confusing
assertion mismatches. `git rm` the binaries, add `/priv/*.wasm` and
`/zig-out/` to `.gitignore`, and make `just test-demo` depend on `just
build-wasm` so the local flow always builds fresh.
## What this gates
The gate is the property test itself, not a flag grep. If `e2e —
Build-mode invariant` is red, the SNIFS isolation claim is void on the
affected build. The test discriminates both directions:
- ReleaseSafe artifact + illegal input → `{:error, _}` (trap surfaced)
- ReleaseFast artifact + same input → `{:ok, [195_948_557]}` (canary
leaked) — proving the test actually catches the absence of safety checks
rather than passing trivially
## Test plan
- [ ] `e2e — Build-mode invariant` job goes green
- [ ] `setup-zig@abea47f...` and `setup-beam@fc68ffb...` both resolve
(the fake SHAs would have 422'd)
- [ ] Both `priv/safe_nif_ReleaseSafe.wasm` and
`priv/safe_nif_ReleaseFast.wasm` are built fresh from source in CI
- [ ] All 11 tests in `demo/test/snif_demo_test.exs` pass — including
the tightened `ReleaseFast: oob reads canary from adjacent memory —
DANGEROUS` assertion
- [ ] `just test-demo` works locally end-to-end (build-wasm dep ensures
fresh artifacts)
Requires Elixir 1.15+, OTP 26–27 (precompiled wasmex NIF downloaded automatically). OTP 28 is not yet supported because the current Hex release (2.4.2) ships BEAM bytecode that fails to load on OTP 28 — re-evaluate when Hex publishes a release recompiled for the post-OTP-26 instruction set.
0 commit comments