What the review read and ran
An appendix to the milestone.
The crate
partsfoundry/capability_table at a0e8b159e550943828d4ddb61137e53a2c2cd631, version 0.1.0,
edition 2024, rust-version 1.85, no dependencies, one feature (peak) and publish = false.
Read: Cargo.toml, README.md, CHANGELOG.md and all of src/lib.rs above the proofs, which is
every public item. The review read src/tests.rs and the twelve Kani harnesses for their names
only, and listed falsifications/ and docs/ without reading them.
The commands
A Linux x86_64 host with rustc 1.100.0 ran each one in a copy of the clone, building outside it.
cargo buildandcargo build --features peakpass.cargo test: 28 unit tests and 2 doctests pass. The crate's development dependency on itself turnspeakon for every test run, socargo test --no-default-featuresruns the same 28 and 2.cargo +1.85 test, the declared minimum: the same 28 and 2 pass, andcargo +1.85 build --lib --target x86_64-unknown-nonepasses.cargo doc --no-deps, and again withRUSTDOCFLAGS="-D warnings"and--features peak: both pass.cargo clippy --all-targetspasses with no warning. With-W clippy::pedanticit reports seven functions with no# Errorssection and eleven that could carry#[must_use](P1-4).cargo build --lib --target x86_64-unknown-none,riscv64imac-unknown-none-elfandaarch64-unknown-none-softfloat, each with and without--features peak: all six pass.cargo package --list --allow-dirtylists 50 files, among them.github/,.githooks/,.cargo/mutants.toml,deny.toml,_typos.toml,CODEOWNERSandfalsifications/(P1-2).cargo package --allow-dirty, withpublish = falseremoved in the copy, fails:no matching package named capability_table found, required by the crate itself (P1-1). With theversionkey also removed from the development dependency, it verifies, andcargo testpasses as above.grep -n '# Errors' src/lib.rsand a search forforbidandmust_useprint nothing.- The feature combinations are two, with and without
peak, and both build on every target above.
The comparators read
The review took each .crate at the prior-art table's version, unpacked it apart and read it.
The download figures are the crates.io API's on 2026-11-26 (UTC). Searches there for a capability
table, a handle table, cspace, cnode, zircon, sel4 and the keywords capability and
capabilities find no other library that holds such a table.
ruvix-cap0.1.0:CapabilityTable<const N: usize = 1024>(src/table.rs) holds an array ofCapTableEntry, each with public fields for the capability, a generation, a validity flag, an owner, a depth and a parent. It hasallocate_root,allocate_derived,lookupreturning&CapTableEntry,lookup_mut,deallocate,capacity,len,is_empty,is_fulland aniterthat returnsimpl Iterator. It finds a free slot by a scan from a hint. A stale generation answersStaleHandle.CapError(src/error.rs) derivesDebug,Clone,Copy,PartialEqandEq, has twelve variants andas_str, and implements neitherDisplaynorcore::error::Error.DerivationTree::revoke(src/derivation.rs) returns the count revoked.src/lib.rscarries#![forbid(unsafe_code)]. Features:alloc,std,audit-logandmetrics.ruvix-types0.1.0:CapRights(u32)(src/capability.rs) with seven rights,from_bitsthat keeps every bit,bits,contains,union,intersection,difference,is_subset_of,Default,Hashand the|and&operators.Capabilityhas five public fields and anew, andderivereturnsOption<Self>, refusing withoutGRANTor on a wider request.CapHandlewraps an index and a generation.sel40.0.12:SlotRef(src/cspace.rs) withcopy,mint,deleteandrevoke, each a call into the kernel throughsel4-sys. It holds no table of its own.fuchsia-zircon0.3.3:Rights(src/rights.rs) is abitflagstype overzx_rights_t;Handle::replaceandHandleRef::duplicate(src/handle.rs) take the new rights and call the kernel.slotmap1.1.1:SlotMap(src/basic.rs) withinsert,getreturningOption<&V>,removereturningOption<V>,retain,lenandcapacity. Features:std, on by default, andunstable.bitflags2.13.2: theFlagstrait (src/traits.rs) withfrom_bitsreturningOption<Self>,from_bits_truncate,from_bits_retain,bits,contains,unionandintersection. Features:std,serdeandexample_generated.cap-std4.0.3: the review measured it and did not read it.
The systems outside Rust
- seL4 13.0.0, fetched by tag:
src/object/cnode.c,include/object/structures.h,src/kernel/cspace.candlibsel4/mode_include/64/sel4/shared_types.bf. A slot is acte_t, a capability beside anmdb_node_tthat links it into the derivation list.cteInsertasserts that the destination is empty and links the new slot after its source.cteRevokedeletes each following slot thatisMDBParentOfaccepts, with a preemption point between them.lookupSlotresolves an address throughresolveAddressBits.seL4_CapRightshas four bits: grant-reply, grant, read and write. GPL; read for its interface shape only. - Zircon, the head of
releases/f20at commit639288a04e0b7f4b8dd6205c93350813979a9802:zircon/kernel/object/handle_table.cc,zircon/kernel/object/include/object/handle_table.h,zircon/kernel/object/include/object/handle.handzircon/system/public/zircon/rights.h.HandleTablekeeps a locked list of handles and a count. A handle value is the handle's arena index shifted and mixed with a per-table random word, with its low bits fixed.RemoveHandlereturns theHandleOwner.Handleholds aRefPtr<Dispatcher>and aconstrights word.rights.hdefines 25 rights andZX_RIGHT_SAME_RIGHTSin auint32_t.
The benchmark
A scratch crate depending on the crate's copy by path, on ruvix-cap at =0.1.0 and on slotmap
at =1.1.1, built with cargo build --release and run three times. Each table has room for 256
and holds 128 entries, inserted before the timed part. The entries are a Capability<u64> with
READ and GRANT here, a ruvix-types Capability with the same two rights placed by
allocate_root, and a (u64, u32) in a SlotMap made with with_capacity(256). Each row starts
at 64 repeats and doubles until a pass lasts 50 ms, then runs seven passes and reports the lowest
divided by the operations, with black_box on each slot, key, value and result.
- Look up one of 128:
get,lookupandSlotMap::geton each of the 128 in turn. - Look up and derive:
CapabilityTable::derive(slot, READ)here;lookupthenCapability::derive(READ, 0)forruvix-cap.slotmaphas no such operation. - Insert one, then delete it:
insertthendelete;allocate_rootthendeallocate;insertthenremove. One pair counts as one operation. - Insert 128 more, then delete them: 128 inserts into the half-full table and 128 deletions, divided by 256.
- Iterate:
iterover the 128, summing a word of each entry, divided by 128.
size_of gives 4,136 bytes for CapabilityTable<u64, 256> and 14,352 for ruvix-cap's
CapabilityTable<256>.
What was not run
- The review read seL4 and Zircon and built neither.
- No benchmark of
delete_matching,insert_atorinsert_at_or_above, which no comparator matches like for like. - No benchmark with the
peakfeature on, so the cost of its atomic write on growth is not measured. - Kani, mutation testing and the falsification patches were not run.
- The host has no 32-bit target, so the review read the slot conversions and built none for one.