Skip to content

Bulk attachment lane

The bulk attachment lane moves admitted raw bytes, Arrow IPC data and CPU tensor host memory between process cells. The nucleus keeps buffer lifetime and byte credit authority. The transport owns one sealed backing, one bounded descriptor and one read-only mapping for each admitted buffer generation.

Ownership and movement

flowchart TB
  subgraph HOST["NUCLEUS HOST"]
    direction TB
    AUTH["Buffer authority and delegated byte reservation"]
    STORE[("Sealed backing generation")]
    SEND["Descriptor and file-descriptor handoff"]
  end
  subgraph READER["READER MONITOR"]
    direction TB
    ADMIT{{"Descriptor, seal and digest admission"}}
    MAP[("Read-only imported mapping")]
  end
  AUTH -->|"permits exact bytes and reader identity"| STORE
  STORE -->|"sealed descriptor plus one file descriptor"| SEND
  SEND -->|"private SCM_RIGHTS handoff"| ADMIT
  ADMIT -->|"accepted generation"| MAP

Buffer authority and delegated byte reservation decides the generation, reader and byte limit. Sealed backing generation holds the admitted bytes. Descriptor, seal and digest admission creates Read-only imported mapping only when the operating-system object and the authenticated descriptor agree.

The call ring carries the attachment count, total attachment bytes and ordered digest of the canonical descriptor set. All three values must equal the nucleus reservation before publication, so a different descriptor set with the same byte total cannot spend that reservation. The attachment object follows a separate private, deadline-bounded file-descriptor handoff, so ring capacity cannot create buffer authority or byte credit.

Descriptor contract

The lane carries one SealedAttachmentDescriptor for the current dedicated backing generation.

Field group Bound value
Identity Descriptor version, backing id, buffer id and generation
Window Zero backing offset and exact non-zero byte length
Access read_only rights
Data model Logical kind, format and canonical XBufferDescriptor bytes
Integrity Content digest and digest of the complete descriptor

The canonical XBufferDescriptor names a memfd backing with sealed state and read-only mutability. Raw data uses the raw format. Columnar data uses Arrow IPC. CPU tensors use host bytes plus their admitted TensorLayoutV1. The crossing carries host memory only, and device memory stays in the cell that owns it.

Seal and import boundary

stateDiagram-v2
  [*] --> allocated
  allocated --> writing: sequential digest-verified chunk
  writing --> sealed: exact length committed
  sealed --> mapped: descriptor and file admitted
  mapped --> sealed: reader mapping released
  sealed --> zeroed: authoritative release
  zeroed --> [*]: generation removed

The nucleus host creates the backing at its final size and starts it with zeroed bytes. Writes are sequential, bounded by that extent and checked against each chunk digest. Completion seals a Linux memfd against growth, shrinkage and future writable mappings, then binds the content digest into the descriptor.

The reader monitor receives exactly one file descriptor. It checks the complete Linux seal set, exact file extent, descriptor digest, canonical buffer descriptor and content digest before mapping the file read-only. The reader identity includes its cell id, cell epoch, handle slot and handle generation. A changed generation or recycled handle fails admission.

When an untrusted provider stages a stream batch directly, Linux proves that the producer has relinquished write access. The provider blocks new writable mappings, drops its known writer, acquires the write seal and then locks the seal set. A retained writable alias prevents the write seal, so the monitor refuses the handoff before mapping or hashing the bytes. Monitor-owned ordinary attachments use a separate trusted lifecycle: the monitor retains the only writable mapping for terminal zeroing and never exposes that mapping to guest code.

Release and reclamation

Buffer authority in the nucleus controls terminal release. The nucleus host stops the reader process before it removes the reader identity from the backing. Once the live-reader set is empty, reclamation overwrites the complete backing through the retained host mapping, records the zeroed extent digest and removes the generation.

A reader shutdown failure keeps the backing, the recoverable process handle and the exact reader authority for supervisor recovery. This preserves the bytes while a reader process may still hold a mapping. Once the supervisor proves that cell epoch has exited, it idempotently detaches the exact reader, zeroes and reclaims the backing, and retains the zeroing receipt until nucleus buffer authority admits the death and reclamation transitions. Tenant mismatch, changed bounds, changed format, malformed rights, absent seals, an incorrect digest and a stale generation all fail at the receiving boundary.

The Call completion ring declares the attachment bytes. Credit backpressure owns their reservation, and Ring reset and attachment reclamation describes terminal ordering across channel reset.