Allocator verification assessment

Researched 4 November 2026 against SDK 757bf506bb84c6487d6b367d56bb7f7bed96aea3. At the start of this assessment no verifier was installed and no compatibility experiment or allocator proof had been run. The executable allocator harness now implements the first native geometry and contract checks. The page-authority work continues with Verus and Creusot. The larger scopes below remain a roadmap, not a completed allocator verification claim.

Source boundary

The useful bottom-up boundary is shared page authority, allocation engine, runtime/Nyxus adapters, then startup and retained-memory reopening.

Layer Current implementation Important responsibility
Shared main-memory page authority page_pool.rs Disjoint Runtime, Store and Control runs; exact run boundaries; ownership summaries; recovery
Allocation engine transient.rs Slab slots, per-page buddy maps, intrusive bins, direct page runs and resize
Wasm and host adapters wasm.rs (source unavailable) and Nyxus allocator Physical growth, absolute addresses, GlobalAlloc/Allocator contracts and exclusive access
Startup and reopening runtime-memory contract (source unavailable) and upgrade contract (source unavailable) Reject incompatible images before interpreting retained pointers; reclaim only the quiescent Runtime domain

Ordinary runtime allocation and Nyxus use the same AllocatorHeap algorithm, with different band parameters (Heap and HintedHeap). Proving the Nyxus wrapper alone would miss most of the allocation machinery. Hylix and Minima stable allocation are additional proof scopes, not consequences of this one.

Candidate tools

Tool Useful role here Qualification needed
Kani Symbolic checks of production arithmetic, bitmap transitions and bounded allocation histories Bounds, pointer-model applicability and supported Rust features must be explicit
Verus Inductive ownership and functional-correctness proofs with erased specifications and permission tokens Raw-pointer subset, trusted primitives and source/erasure correspondence need review
Creusot Contracts and ghost ownership, with an erasure check connecting annotated functions to original bodies Pointer operations, allocator features and the erasure check must fit this source
VeriFast Separation-logic proofs of unsafe pointer manipulation, with annotations separate from executable behavior Rust/toolchain support and the supported memory model need a small feasibility trial
RefinedRust Foundational safe/unsafe proofs checked in Coq A larger proof and toolchain investment; prototype feature coverage needs assessment

Kani checks symbolic inputs rather than sampled test values. A bounded arena or operation history gives a bounded result; successful loop-unwinding checks are required. Its experimental loop contracts can establish inductive properties, but have documented limitations. Current Kani also leaves classes of Rust UB outside its checks, including reference aliasing; a passing harness is not a blanket proof of Rust soundness. See its usage, feature support and loop-contract limitations.

Verus provides static verification without runtime checks. Its current raw-pointer library models provenance and memory permissions, with trusted primitive contracts. A mimalloc-derived verified allocator demonstrates feasibility, but its README reports poor comparative performance and omits aligned allocation and realloc. It is a proof case study, not a suggested replacement. See the Verus guide and raw-pointer API.

Current Creusot supports raw-pointer ghost ownership. Its erasure check syntactically compares verified and original function bodies modulo documented transformations. This is particularly relevant when preserving optimized production code. Trusted functions can bypass that check; cross-crate checks must be enabled as errors rather than left as warnings. It does not certify compiler lowering or final Wasm.

VeriFast is another relevant unsafe-Rust candidate. RefinedRust offers foundational proofs with a higher adoption cost. These assessments do not establish that either tool accepts our custom compiler extensions.

Miri complements proofs by detecting UB in executed tests; it does not prove all possible executions. Aeneas currently targets a safe Rust subset, so it is more natural for isolated safe algorithms than this raw-pointer core.

Properties worth proving

Start from a valid state and callers satisfying the allocator's unsafe contract: deallocation receives the exact live pointer and Layout, with exclusive ownership. Proving those preconditions at callers is a separate obligation.

  1. Page partition: live runs do not overlap; Control reservations never become payload; ownership and boundary summaries agree with authoritative bits.
  2. Geometry: every admitted Layout maps to an adequately sized, aligned slot or run; recovering a page/span header names the original allocation domain; rounding and address arithmetic stay within the target's bounds.
  3. Allocation state: live slots and free slots are disjoint; counters agree; intrusive links, bin membership and buddy summaries remain valid.
  4. Release: only owned storage is freed; buddy coalescing preserves coverage; pages return to the provider only when wholly empty; other live bytes remain unchanged.
  5. Resize and failure: success preserves the required prefix and alignment; failure leaves the old allocation live with unchanged payload; zeroed growth clears exactly the newly exposed bytes.
  6. Recovery: after an admitted quiescent handoff, Runtime reclamation preserves all Store/Control runs and retained payloads. This requires the separate shutdown and startup contracts, not just an allocator invariant.

Termination and algorithmic work bounds can be additional specifications. Exact IC instructions and generated-code size still require artifact measurements.

Proposed first steps

First try Kani on the actual small_class, stride, span_bytes, span_order, slots and run_geometry bodies, with symbolic valid layouts and explicit 32/64-bit assumptions. Finite geometry can be covered completely where the chosen harness domain equals the function's full admitted domain.

Then check one page's split/coalesce transitions and the shared pool's claim/release transitions using real arena-backed PageSource/Backing implementations. Inject growth failure and preserve a distinguished live allocation. The existing buddy_state test already supplies an independent cell-coverage model for reserved, live and free spans; use it as a specification seed rather than trusting the allocator's own summaries.

The initial feasibility gate must exercise address masking and pointer recovery. CBMC's pointer model uses object identities and offsets, which must not be casually equated with flat Wasm addresses. A model mismatch needs an explicit correspondence or another tool, not assumptions that hide the operation under investigation.

For arbitrary legal allocation histories, prove initialization establishes the invariant and every operation preserves it. Compare Verus and Creusot on the same small ownership transition before committing to a full proof framework; consider VeriFast if it better preserves the existing pointer implementation. Do not maintain independent unconnected allocator implementations for each tool.

Preserving performance and stating trust

Keep verifier toolchains and dependencies outside normal application builds. Kani harnesses run only in verification configurations; deductive proof/ghost code must erase. Prefer unchanged production bodies. Check production code, data layout and generated Wasm after any annotation integration. A refactor requires the normal matched instructions, completed work, memory and latency qualification, including RRT Heavy16. Erasure alone does not prove that a rewritten algorithm has unchanged performance. Allocator source also participates in the SDK's interpretation policy; review that identity when adding annotations even if executable code is unchanged.

The SDK uses a pinned retention compiler and custom allocator APIs. Verifier frontends use their own compiler versions; compatibility is untested. A native proof does not automatically cover wasm32, wasm64, absolute-address creation, memory.grow, linking, the raw startup transformer or IC KEEP/rollback semantics. Native locking and Wasm single-threaded/nonreentrant execution are also separate scopes. List every remaining trusted provider, primitive and compiler/runtime assumption alongside each completed proof.

The immediate engine boundary is the unsafe PageSource and Backing contracts: exclusively owned, disjoint, pinned and absolutely aligned page runs; growth preserving existing bytes and providing zeroed new pages; correct release and zeroing; and no allocator/provider reentry. An engine proof may assume these contracts, while the corresponding provider proof must establish them.