C11 - Host Daemons, Audit, and Disks
Purpose: The test cases for the host daemons’ own checks:
wb-vmd’s device set and slots, the image build bundle, supervision,
the accounting and event channels, the daemon log pipes, the audit
writer, free space, and the data disk steps.
Verifies: S04-02-vm-providerS04-02-vm-provider: VM Provider and StreamsHow wb-vmd hands guest connections and the NIC endpoint to other processes, the fixed device set of a VM, and where wb-proxyd takes a stream's identity from. (“The device set is fixed and checked”, “Guest ports below 1024”, “Hand-off on macOS”, “The host opens every connection”, “Caps and closing”), S06-12-guest-agentS06-12-guest-agent: Guest AgentWhat wb-guestd, the service in the guest, does for the host, and how it updates itself. (“The hello”),
S06-11-reconnect-and-recoveryS06-11-reconnect-and-recovery: Reconnect, Loss and RecoveryWhat happens when the host-guest link drops, when a session is lost, and how a lost session's work is recovered or discarded. (“Reconnect”), S06-06-devices-and-warm-startS06-06-devices-and-warm-start: Devices, Warm Start and TimeA VM's devices and resources, saving and restoring its state, and how the guest clock follows the host. (“When the host sends the time”, “Network device per slot”, “The Xcode disk”, “MAC address”), S07-02-packet-pathS07-02-packet-path: Packet PathHow wb-netd carries the guest's frames: the packet transport, the stack, the link filter, its caps, addressing, the MTU and connections. (“Packet transport”, “MTU”), S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs. (“Host work the guest can cause”),
S04-03-self-sandboxingS04-03-self-sandboxing: Self-SandboxingHow each host daemon confines itself at startup, and the wb-launcher that starts confined programs on macOS. (“Each host daemon is self-sandboxed”, “Confined first thing in main”),
S04-07-supervisionS04-07-supervision: SupervisionWho starts and restarts each host process, what happens when wb-hostd stops or the bundle is upgraded, and daemon outages., S04-05-helper-programsS04-05-helper-programs: Helper ProgramsThe programs that run once for an image build or a store operation: wb-guestadmin, wb-release-check, wb-download and wb-build-ssh. (“wb-build-ssh”), S07-05-stream-hand-offS07-05-stream-hand-off: Stream Hand-offHow wb-netd hands each stream to wb-proxyd, and the checks that keep a compromised wb-netd from widening what a stream may reach. (“Message form”, “Streams”, “Resets”), S07-06-name-mappingS07-06-name-mapping: Name MappingHow wb-proxyd keeps its own checked copy of the names wb-netd gave synthetic addresses: name reports, releases, replay, lifetime, the second count of the wildcard budget, and the copy wb-hostd keeps. (“Name reports”, “Releases”), S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs. (“Accounting and event channels”, “Logs and health”), S06-05-disksS06-05-disks: DisksA VM's system disk and data disk: how the data disk keeps what the guest flushes, and how the guest mounts it., S06-13-data-disk-formatS06-13-data-disk-format: Data Disk FormatHow the host formats a VM's new data disk, the one exception SEC15-no-guest-disk-mount makes, and the checks before a VM starts with its disk.,
S09-11-auditS09-11-audit: AuditWhat the audit log records, the budgets that bound it, and what happens when the log can't be written., S09-13-event-sendersS09-13-event-senders: Event SendersHow wb-hostd tells the senders of event records about the audit budgets, what it holds back, and when it stops a VM for its records., S04-04-vm-processesS04-04-vm-processes: Per-VM ProcessesOne wb-vmd for each VM, the wb-vmd-layer entry of the Claude Code layer build, the wb-vmd-recipe entry of a named image's recipe, and wb-diskfmt, which formats a VM's new data disk., S05-03-management-commandsS05-03-management-commands: Management CommandsThe commands of wb other than the agent commands. (“wb vm”), S06-07-slot-admissionS06-07-slot-admission: Slot AdmissionHow wb-hostd admits every macOS VM it starts against the limit of two, and lends the isolated VM's slot to a maintenance VM. (“Other software”), S06-12-guest-agentS06-12-guest-agent: Guest AgentWhat wb-guestd, the service in the guest, does for the host, and how it updates itself. (“Guest tools disk”)
Unit tests
Section titled “Unit tests”wb-vmd
Section titled “wb-vmd”- Device set (S04-02-vm-providerS04-02-vm-provider: VM Provider and StreamsHow wb-vmd hands guest connections and the NIC endpoint to other processes, the fixed device set of a VM, and where wb-proxyd takes a stream's identity from., “The device set is fixed and checked”, X25-vmd-sandboxX25-vmd-sandbox: Self-sandboxed `wb-vmd`Can wb-vmd confine itself at start with a Seatbelt profile that allows the Virtualization framework, its VM bundles under <data>/vms and nothing else, and still create, start, save and restore a macOS VM?). Pass the check each of these, and see
each refused with its rule: a NAT network, a bridged network, a
file-handle network in the build or layer slot, a shared directory, a
console or SPICE device, an audio device, a disk or serial port file
outside the VM’s bundle, a second network device, a symbolic link at
a bundle file’s name, and a missing bundle file. The fixed set of
S06-vm-lifecycleS06-vm-lifecycle: VM Lifecycle, Images and the Guest AgentHow guest images are built, how VMs are kept warm, how projects and sessions map onto guests, and what wb-guestd does. is accepted in every slot. A work or isolated VM
without its file-handle network device is refused with
device-set-count, and every other attachment is refused in every slot, in place of the file handle too (DeviceSetNetworkTests). - Xcode disk (S06-06-devices-and-warm-startS06-06-devices-and-warm-start: Devices, Warm Start and TimeA VM's devices and resources, saving and restoring its state, and how the guest clock follows the host., “The Xcode disk”). In
the
layerslot with the Xcode flag, the set with the read-only Xcode disk onxcode.imgis accepted. The check refuses withdevice-set-counta set with the Xcode disk but without the flag, or in thework,isolatedorbuildslot, a set with it twice, and a set without it when the flag is set. It refuses a writable one withdevice-set-disk, and one outside the bundle withdevice-set-file-outside-bundle. A start call with the flag in any slot butlayeris refused withvmd-xcode-disk-refusedbefore any device is created. - Bundle file names (S06-05-disksS06-05-disks: DisksA VM's system disk and data disk: how the data disk keeps what the guest flushes, and how the guest mounts it., “Names on the host”). Each
guest-written bundle file has an extension that maps to a dynamic
type, so Launch Services doesn’t open it as a disk image. A clone of a spike
bundle that kept
aux.img,sys.imganddata.imgis refused withbundle-file-missing. - Host. On a macOS older than 27,
wb-vmdis refused withvmd-host-unsupportedbeforesandbox_init, whatever its slot. - Slot. Start
wb-vmdwithWB_VMD_SLOTunset, with an unknown value, with thelayerslot, with its bundle a symbolic link to the other slot’s bundle, and with its bundle missing. Seevmd-slot-missing,vmd-slot-unknown,vmd-slot-layer-unsupported,vmd-slot-bundle-mismatchandvmd-bundle-missinglogged beforesandbox_init. - Build slot (S04-10-vmd-installS04-10-vmd-install: Installing macOS in `wb-vmd`The wb-vmd-install entry of an image build: its install rules, the restore image it reads, the build bundle it installs into, and its Install call., “
wb-vmd-install”, “The restore image”;BuildSlotTests). Thebuildslot resolves to the build bundle and the real path of the restore image. Theworkslot resolves without one. A restore image that is missing, a directory, a symbolic link, or a hard link is refused withvmd-restore-image-mismatchbeforesandbox_init. The build profile is thewb-vmdprofile plus the three install rules withIPSW, and thework,isolatedandlayerprofiles are thewb-vmdprofile and mention neitherIPSWnor the installation service. Only the build slot passesIPSW, and a build slot without a restore image path is refused withvmd-sandbox-param-invalid. - Start interface (S04-11-vmd-startS04-11-vmd-start: Starting `wb-vmd`What wb-vmd inherits from its spawner, the socket it serves gRPC on, its lifeline, and the checks on each connection., “How
wb-vmdis started”). An argument is refused withvmd-arguments, and a missing descriptor or one of the wrong kind withvmd-descriptor-invalid. Closing the lifeline stops the VM. Unconfined, the deny probe refuses. An empty sandbox parameter, or one with a NUL byte, is refused withvmd-sandbox-param-invalidbefore confinement. In the build slot, descriptor 5 is accepted as a pipe, and a missing one, a socket, or a file is refused withvmd-descriptor-invalid. In every other slot an open descriptor 5 is refused withvmd-descriptor-invalid(BuildSlotTests).vmdspawnin Go starts the build slot with the password pipe as descriptor 5 and no other descriptor (TestSpawnBuild), and refuses a build slot without the pipe and any other slot with one before it makes anything (TestConfigRefused). - Build password input (S15-04-guest-adminS15-04-guest-admin: The Guest Admin UserHow the host keeps the password of the guest admin user wbadmin, from the image build to each VM's first contact., “Build”;
ProvisioningInputTests). A printable ASCII password of up to 256 bytes is read to end of file. An empty, a 257-byte, and a non-ASCII password, one with a control byte, one whose writer doesn’t close the pipe within the deadline, a second read, and a read after the pipe was closed unread are each refused withvmd-provisioning-password-invalid, and no refusal holds the password’s bytes. The pipe is closed after the read, and a wiped password is empty. - Install (S04-10-vmd-installS04-10-vmd-install: Installing macOS in `wb-vmd`The wb-vmd-install entry of an image build: its install rules, the restore image it reads, the build bundle it installs into, and its Install call., “The install call”;
InstallTests, with a fake engine). In thework,isolatedandlayerslotsInstallis refused withvmd-install-refused, with no file created and the restore image not read. A build bundle that already holdshw.bin,mid.bin,aux.wbstoreorsys.wbdiskis refused withvmd-install-refusedand left unchanged. Resources outside the host’s range are refused withvm-resourcesbefore any file. An image the host can’t run is refused withvmd-restore-image-unsupported, with no file created. An install creates the four files, with the image’s hardware model inhw.binand a 64 GiB sparsesys.wbdisk, installs from the fixed restore image path with the build slot’s fixed set and no network device, and streams rising whole percents that end at 100. A second install, and one while the VM runs, are refused withvmd-install-refused. A framework failure ends the stream with a message that holds itsVMError, and the call is refused withvm-install-failed.Startin the build slot boots the build slot’s fixed set. - Provisioning start (S04-10-vmd-installS04-10-vmd-install: Installing macOS in `wb-vmd`The wb-vmd-install entry of an image build: its install rules, the restore image it reads, the build bundle it installs into, and its Install call., “The build password
pipe”;
ProvisioningStartTests, with a fake engine). AStartwithprovisioningset in thework,isolatedandlayerslots is refused withvmd-provisioning-refused, before the engine gets a request. In the build slot it hands the engine the password from the pipe, which is wiped after the start and is in no log line. A build slotStartwithoutprovisioningdoesn’t set the options, and closes the pipe unread. A second provisioning start, one after the pipe was closed, and one with an empty or non-printable password are refused withvmd-provisioning-password-invalidbefore the engine gets a request. - Peer check and version record (S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves., “The version
record”). A peer of another user ID is closed with
ipc-peer-uidand doesn’t get a byte, and the next connection is served. A peer of another version, an unstamped one, one outside the version form, a silent one and one that sends a wrong magic each get their rule, and no handler runs. Arbitrary bytes never parse to a version that isn’t 1 to 64 bytes of printable ASCII. - VMService. With a fake VM, each refusal comes back with its rule
as the
ErrorInforeason:vm-resources,vm-already-running,vm-generation,vm-stop-mode,vm-starting,vm-config,vm-watch-limit, and a device-set refusal passed through. A stop forwb-vmd’s exit during a start waits for it, then stops the VM. - ConnectGuest (S04-02-vm-providerS04-02-vm-provider: VM Provider and StreamsHow wb-vmd hands guest connections and the NIC endpoint to other processes, the fixed device set of a VM, and where wb-proxyd takes a stream's identity from., “Hand-off on macOS”, “Caps
and closing”). With a fake socket device and a real hand-off
socketpair (
ConnectGuestTests),guest-port-not-reserved,vm-request-id,vm-generation,vm-not-running,connect-cap,vm-connect-failed,vm-connect-timeoutandhandoff-send-failedeach come before any record is sent. A connection is sent once with the request’s fields, andwb-vmd’s copy is closed once the test acknowledges the record. A passed connection keeps its place underconnect-capuntil then. - Hand-off acknowledgment (S04-02-vm-providerS04-02-vm-provider: VM Provider and StreamsHow wb-vmd hands guest connections and the NIC endpoint to other processes, the fixed device set of a VM, and where wb-proxyd takes a stream's identity from., “Hand-off on macOS”;
S04-12-descriptor-passingS04-12-descriptor-passing: Passing DescriptorsHow one host process passes an open socket to another: who holds it when, how the receiver shows it holds it, when the sender closes its copy, and what a lost or bad acknowledgment does., “Acknowledgments are input”;
HandoffKeeperTests,HandoffReaderTests). A sent connection and a sent packet transport are kept until theirHandoffAck, accepted or refused, and closed at a short deadline without one, logged withhandoff-ack-timeout. An acknowledgment that comes late, names another request or generation, is of the wrong form, is empty, over 256 bytes, or carries a descriptor is refused withhandoff-ack-unexpectedorhandoff-ack-malformed, and the right one still closes the copy. A descriptor that comes with an acknowledgment is closed. A refused acknowledgment and a single failed receive are skipped, and the next acknowledgment still closes its copy (I751I751 (closed): wb-vmd: a bad hand-off ack or failed receive is skipped, not the end of the ack readerBuilds S04-12-descriptor-passing, "Acknowledgments are input", in wb-vmd's acknowledgment reader (#754, PR #758).). The reader ends, logged withhandoff-ack-channel-endedonce, whenwb-hostdcloses its end, on control data that was cut, or after the bound of failed receives in a row. The kept copies then close at their deadline. Closing the keeper closes every kept copy at once and refuses later sends. It closes the channel’s own descriptor only once its read source has stopped, so libdispatch never watches a closed descriptor (I781I781 (closed): WraithBoxVMDTests: swiftpm-testing-helper exited with signal 11 once in a local mise run ciSeen once in a local mise run ci on a macOS 27 (Darwin 27.2) host while building #731 (PR #779), which changes only a Go test.).closeRightscloses the descriptors of one or twoSCM_RIGHTSmessages and none of a message whose length is under the header’s or past the end, or of another type or level. - Packet transport (S07-02-packet-pathS07-02-packet-path: Packet PathHow wb-netd carries the guest's frames: the packet transport, the stack, the link filter, its caps, addressing, the MTU and connections., “Packet transport”, “MTU”;
NetworkTransportTests). Both ends of the socketpair areAF_UNIXdatagram sockets, close-on-exec, withSO_RCVBUFat least twiceSO_SNDBUF. The attachment has MTU 65535, the VM’s MAC address and its own copy of the VM end.Startsends oneKIND_NETWORKrecord with the host end and the generation only before the VM starts, andwb-vmdkeeps its copy until the record’s acknowledgment. A record that can’t be sent refuses the start withhandoff-send-failed. - MAC address (S06-06-devices-and-warm-startS06-06-devices-and-warm-start: Devices, Warm Start and TimeA VM's devices and resources, saving and restoring its state, and how the guest clock follows the host., “MAC address”). A
multicast, a universally administered, a broadcast, a short, and an
empty address are each refused with
vmd-mac-invalid, andStartrefuses one before it builds a VM or sends a record.
VM boot (needs-vm)
Section titled “VM boot (needs-vm)”-
With
WB_VM_TEST_BUNDLEnaming a spike bundle,mise run swift:test-vmclones it into the work slot and starts the signedwb-vmdwith its start interface. SeeRUNNINGthroughWatchState, the logged device list equal to the fixed set, a forced stop reachSTOPPED, a data disk linked out of the bundle refused withdevice-set-file-outside-bundleandwb-vmdstill answering, and a closed lifeline end the process with status 0. The slot is deleted afterwards. Pass or fail, the test prints howwb-vmdended and every record it logged. After the first start reachesRUNNING, the test reads theKIND_NETWORKrecord from the hand-off channel and waits up to 300 s for a DHCPDISCOVER from the VM’s MAC address on the transport. -
Install (
VMInstallTests, needs-vm and needs-host). WithWB_VM_TEST_RESTORE_IMAGEnaming a restore image in the spike cache,mise run swift:test-vmclones it to<data>/images/macos-restore.ipsw, makes the build bundle withtools.imgand an empty sparse 8 GiBdata.wbdiskin it, and starts the signedwb-vmdin the build slot with descriptor 5 a pipe. The test refuses to run when the bundle or the image is already there. SeeInstallstream rising percents that end at 100 and no error, the bundle hold the six bundle files, the bundle boot toRUNNINGwith the build slot’s fixed set, a forced stop reachSTOPPED, and a closed lifeline end the process with status 0. The install’s time is logged withmeasure:. The test deletes the bundle, the clone, and the directories it made. The install calls Apple’s signing server over the host’s network (X30-installer-trustX30-installer-trust: Installer refusal of a changed restore imageDoes the Virtualization framework's macOS installer, run by wb-vmd-install, refuse a restore image that Apple didn't sign, or one with a changed or replaced component, and does the install contact Apple while wb-vmd-i…). -
wb-hostdon a VM (TestC11HostdVMincmd/wb-hostd, needs-vm). WithWB_VM_TEST_BUNDLEnaming a provisioned test bundle,mise run go:test-vmbuilds the bundle. The test clones it into.scratch/go-test-vm/test-appwith awb-vmdand awb-diskfmtbuilt with a test data root of its own (S06-05-disksS06-05-disks: DisksA VM's system disk and data disk: how the data disk keeps what the guest flushes, and how the guest mounts it., “Test data root”), and runs the test binary aswb-hostdfrom the clone, with<config>and<logs>in.scratch/go-test-vm. The test data root is a new directory under the system’s temporary directory, which the test removes at its end. The test fails when the real<data>exists at the end and didn’t at the start, or the other way round, or when its inode or modification time changed. A file made or removed directly in<data>changes the modification time, and one deeper down doesn’t. Throughwb vmit checks:startlinks,statusshows the guest’s version equal to the build’s and the generation,tools.imghas a new inode, and the boot’s time call took under 1 s;- closing
wb-hostd’s end of the link (SIGUSR1 to the child) links again within 2.1 s; stopreaches stopped, andwb-vmdexits;- after
kill -9ofwb-hostd, itswb-vmdexits by the lifeline. A newwb-hostdstarts the VM at once, and the test logs the outcome; - a bundle whose tools disk has another build’s
wb-guestdandVERSION:startexits 255, andstatusshows the refusal withpeer-version-mismatchand both versions.
Each measurement is logged with
measure:. Runs:- 2026-10-25, macOS 27 on Apple Silicon, I288I288 (closed): wb-hostd on a VM: wb vm start boots the fixture bundle, links to wb-guestd, sends the time, reconnects and stopsM2.7a (#283) to M2.7e (#287) are tested with fakes. fixture, build
0.0.0+g90b07d3d8a955e8e: pass. Start to accepted hello 14.1 s, boot time call 2.7 ms, link closed to accepted hello 103 ms.stoptook 30.0 s, because the request-stop timeout ran out (I414I414 (open): wb vm stop: the guest ignores the requested stop, so every stop waits out the 30 s timeoutIn the needs-vm run of #288 (#412, head 753eae1, fixture bundle i379/fixture), wb vm stop work took 30.0 s and wb-vmd exited 30.01 s after the stop began.). Afterkill -9, the oldwb-vmdexited 11.8 s after the kill, and the newwb-hostd’s start exited 0 at generation 3. - 2026-10-25, same Mac, build
0.0.0+g753eae127c860ddf: failed only on two wrong expectations of the test, fixed since. Start to accepted hello 19.4 s. The other times were within 10 ms of the run above.
-
Restore image. A
wb-vmd-installwhose restore image is a symbolic link, or not at the fixed path, logsvmd-restore-image-mismatchbeforesandbox_init(BuildSlotTestschecks the slot resolution without a VM). -
Provisioning. An instance in the
work,isolatedorlayerslot refuses provisioning options withvmd-provisioning-refused, and thebuildslot accepts them (ProvisioningCheckTests). -
Launcher table. A table test on the
wb-launcherentries checks that eachwb-vmdentry’sWB_VMD_SLOTvalue and its bundle parameter belong to the same slot.TestDiskfmtEntrieschecks the same of eachwb-diskfmtentry’sWB_DISKFMT_SLOT, and that its environment holds nothing else.
Local IPC
Section titled “Local IPC”- Endpoints, peers and versions (S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves., “Inter-process contracts”, “The version record”). Tests in
internal/platform/paths,internal/platform/localipcandinternal/hostversion:HOMEdoesn’t change the paths, an unsafe run directory or endpoint file is refused and left in place, a peer of another user ID is closed withipc-peer-uidand the next one served, each bad version record gets its rule on both sides, and over gRPC no handler runs for a refused version.
Image build
Section titled “Image build”- Leave a symbolic link, a hard-linked file, or a directory at the
sealed disk’s name in the build bundle, and see the build fail with
build-bundle-not-regular, nothing cloned into<data>/images/, and nothing outside the bundle deleted. - Send
wb-hostda port 22 socket from a session VM’swb-netd, one while no build waits for it, and one in a message with two descriptors. See each refused withbuild-socket-refusedand every descriptor closed. Startwb-build-sshwith a socket of another type, and see it exit withbuild-ssh-socket-refusedbefore it reads its standard input (S04-05-helper-programsS04-05-helper-programs: Helper ProgramsThe programs that run once for an image build or a store operation: wb-guestadmin, wb-release-check, wb-download and wb-build-ssh., “wb-build-ssh”). - See
wb-hostdlogbuild-socket-acceptedfor the build VM’s socket. - Run
wb-build-sshagainst a test SSH server whose output repeats the password, whole and split across two reads and across a line cut, and see the password in no log line. See the server’s banner in no log line, and its version and disconnect text escaped and cut. - Run it against a server that never finishes the handshake, one that
goes quiet in the session, and one that writes output without end.
See
build-ssh-login-timeout,build-ssh-idle-timeoutandbuild-ssh-output-limit, and the build fail. - Run it against a server that writes one byte of output every 90 s,
past the session deadline, and see
build-ssh-deadlineand the build fail. - See it offer only password authentication to the test server.
Confinement
Section titled “Confinement”- Self-sandbox (S04-03-self-sandboxingS04-03-self-sandboxing: Self-SandboxingHow each host daemon confines itself at startup, and the wb-launcher that starts confined programs on macOS., “Confined first thing in
main”). In a child,(deny default)denies files, connects and running programs on 32 threads and keeps inherited descriptors working.(allow default), a syntax error, a second call and each bad parameter fail with their rule.
Descriptor channels
Section titled “Descriptor channels”- One descriptor per message (S07-05-stream-hand-offS07-05-stream-hand-off: Stream Hand-offHow wb-netd hands each stream to wb-proxyd, and the checks that keep a compromised wb-netd from widening what a stream may reach., “Message form”). Over real socketpairs, records with and without a descriptor round-trip. An oversized record, two, three and 254 descriptors are each refused with every descriptor closed. A message whose descriptors don’t fit the full descriptor table is dropped, and a send to a full peer fails at once.
- Order and no silent drop (S07-05-stream-hand-offS07-05-stream-hand-off: Stream Hand-offHow wb-netd hands each stream to wb-proxyd, and the checks that keep a compromised wb-netd from widening what a stream may reach., “Transport”). On macOS,
TestOrderUnderLoadininternal/platform/fdchansends 100,000 numbered records of mixed sizes up to 4 KiB, every tenth with a pipe, overSocketpair(4096). The sender gives each record a 5 s deadline and retries a send that fails withENOBUFSorEAGAINbefore it sends the next. A receiver that pauses now and then sees every record once, in order, with its bytes, and reads each pipe under a read deadline. The counts sent and received are equal, and at least one send found the channel full.TestQueueDepthsends with no retry until a send fails withENOBUFSorEAGAIN, and logs the depth: 19 records of 4 KiB, 292 of 264 bytes. - Egress contract form (S07-05-stream-hand-offS07-05-stream-hand-off: Stream Hand-offHow wb-netd hands each stream to wb-proxyd, and the checks that keep a compromised wb-netd from widening what a stream may reach., “The contract”). In
internal/egressmsg, each decoder refuses a record that is empty or over 4 KiB, doesn’t decode, holds a field of another message or of a later build at any depth, doesn’t set a kind, or carries a descriptor its kind doesn’t take or lacks one it does. A name in another form than canonical is refused withname-form, an address outside 198.18.0.0/15 withsynthetic-range, and a VM that isn’t a slot withvm-slot. AHandoffSocketClosedwith another rule thanname-report-malformedor another check is refused. A control message before the start message, and a second start message, are refused.TestLinkRoundTrip: aNetdStartgives back the link it was written from.TestDecodeHostdToNetd: one with no addressing, a short or multicast MAC address, one MAC for both ends, a prefix length outside 8 to 30, host bits in the subnet, a gateway outside it, or the network or broadcast address as the lease is refused with the checkaddressing.TestMACOrder: with both MACs wrong, the guest’s is the one refused. A payload pipe that isn’t a pipe, has a length over 64 MiB, isn’t whole by its deadline, or has a byte after it is refused withpayload-read.TestMaxPayloadsbuilds the largest payloads the bounds allow and sees each under 64 MiB. - Hand-off receiver (S04-02-vm-providerS04-02-vm-provider: VM Provider and StreamsHow wb-vmd hands guest connections and the NIC endpoint to other processes, the fixed device set of a VM, and where wb-proxyd takes a stream's identity from., “Hand-off on macOS”). Tests in
internal/platform/vmhandoffandinternal/vmdlink: over a real socketpair, each refusal of the receiver and offdchanhas its rule, and no descriptor of the record is open after it (fcntl). A record without a kind, or of an unknown one, is refused withhandoff-kind. A good record gives its request a working connection, and the hello runs over it end to end with a fakewb-vmd.FuzzHandoffMessagechecks that no record of arbitrary bytes, the empty one included, is accepted unless it names the open request, the current generation, the host’s direction and the requested port, or is the one packet transport of the current generation, and that every record that decodes has aHandoffAckthat names it.TestAckAcceptedandTestAckRefused: an accepted connection, an accepted packet transport and a refused record are each acknowledged, and a record that doesn’t decode isn’t.TestAckSendFailed: an acknowledgment that can’t be sent is logged withhandoff-ack-send-failed. - Packet transport hand-off (S07-02-packet-pathS07-02-packet-path: Packet PathHow wb-netd carries the guest's frames: the packet transport, the stack, the link filter, its caps, addressing, the MTU and connections., “Packet transport”). In
internal/platform/vmhandoff: aKIND_NETWORKrecord of the current generation with anAF_UNIXdatagram socket gives the waiter aTransportwhose only methods areCloseandStartWith.TestStartWith: a child started with it inherits the descriptor in the given slot, the slot is empty again after the start, a failed one included, and a slot that isn’t an empty placeholder is refused. A record of generation 0 or another generation, one nobody asked for, a generation’s second one, one with a request ID, direction or port, and one with a stream socket are each refused withhandoff-network-refused, with no descriptor left open. A newer generation’s request closes the older one’s. Ininternal/vmdlink:Startreturns the transport, a refused or missing one is refused with its rule and doesn’t leave a descriptor open, and a refusedStartreturnswb-vmd’s error.
Hand-off sender and accounting in wb-netd
Section titled “Hand-off sender and accounting in wb-netd”Spec: S07-05-stream-hand-offS07-05-stream-hand-off: Stream Hand-offHow wb-netd hands each stream to wb-proxyd, and the checks that keep a compromised wb-netd from widening what a stream may reach., S07-06-name-mappingS07-06-name-mapping: Name MappingHow wb-proxyd keeps its own checked copy of the names wb-netd gave synthetic addresses: name reports, releases, replay, lifetime, the second count of the wildcard budget, and the copy wb-hostd keeps., S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs. (“Accounting and event channels”). Tests in internal/netd/handoff and internal/netd/hostlink, over real fdchan socketpairs on macOS:
- Records before the answer (S07-06-name-mappingS07-06-name-mapping: Name MappingHow wb-proxyd keeps its own checked copy of the names wb-netd gave synthetic addresses: name reports, releases, replay, lifetime, the second count of the wildcard budget, and the copy wb-hostd keeps., “Name reports”).
TestAnswerAfterRecords: when a DNS answer is decided, its mapping entry is already on the accounting channel and its name report on the hand-off socket.TestAnswerBlocked: a peer that holds back its version record blocks the write or the send, and after at least 100 ms the name gets the answer every refusal gets, withaccounting-write-failedorhandoff-send-failedlogged and no approval event. A failed accounting write stops the name report too. - Releases (S07-06-name-mappingS07-06-name-mapping: Name MappingHow wb-proxyd keeps its own checked copy of the names wb-netd gave synthetic addresses: name reports, releases, replay, lifetime, the second count of the wildcard budget, and the copy wb-hostd keeps., “Releases”).
TestReleaseRetried: a release that fails on a new hand-off socket keeps its address out of the pool, and is sent before the next name report once the socket works. Its accounting release is written once.TestKeptMapping: a pool started with kept entries answers them with their kept addresses, and gives a kept address out again only after its release reached both peers. - Streams (S07-05-stream-hand-offS07-05-stream-hand-off: Stream Hand-offHow wb-netd hands each stream to wb-proxyd, and the checks that keep a compromised wb-netd from widening what a stream may reach., “Streams”, “Resets”).
TestStreamEnds: the guest sees a FIN when the proxy’s end closes, and an RST when aStreamResetcame first.TestStreamHold:wb-netdkeeps its copy of the end it sent untilwb-proxyd’s first byte or aStreamReset(S07-05-stream-hand-offS07-05-stream-hand-off: Stream Hand-offHow wb-netd hands each stream to wb-proxyd, and the checks that keep a compromised wb-netd from widening what a stream may reach., “Transport”), so a close without either reaches the guest as a FIN only after the hold deadline, logged withstream-hold-expired.TestStreamHoldNoteFirst: that note is logged before the copy is released, so a log handler that blocks on it holds back the guest’s FIN.TestGuestWriteFails: a guest write that fails or passes its deadline resets the guest, logged withguest-write-failedorguest-write-timeout, the stack’s own timeout error included.TestStreamReadFails: a read error on the stream’s socket resets the guest withproxyd-stream-read-failed, or withstream-resetwhen aStreamResetcame first.TestStreamSendFails: a stream send that fails resets the guest and logshandoff-send-failed.TestSocketEnds: a closed hand-off socket, a malformed message on it, a message with a descriptor, and a new socket each reset the old socket’s streams.TestCloseOrder: when wb-proxyd closes the hand-off socket and then a stream’s socket, the guest gets an RST, also whenwb-netdreads the stream’s end of file while the socket is still ending.TestStreamResetUnknown: aStreamResetfor an unknown stream is logged and ignored.TestVersionRecordRefused,TestNoVersionRecordandTestNoSocketcover a refused version record, none within the version timeout (peer-version-timeout), and a send with no socket. - Control channel (S04-07-supervisionS04-07-supervision: SupervisionWho starts and restarts each host process, what happens when wb-hostd stops or the bundle is upgraded, and daemon outages., S07-05-stream-hand-offS07-05-stream-hand-off: Stream Hand-offHow wb-netd hands each stream to wb-proxyd, and the checks that keep a compromised wb-netd from widening what a stream may reach., “One hand-off socket per VM”).
TestStartandTestStartRefused: the start message gives the kept entries and the wildcard counts, and a policy change first, an address outside the range, or a missing payload is refused.TestStartNoVersion: no version record within the version timeout is refused withpeer-version-timeout.TestHandoffSocketRefused: a socket for another VM, for another generation, or of stream type is closed and logged, and the channel goes on to take a good one.TestControlEnds: two descriptors, a second start message, a sequence that doesn’t increase, and a refused policy end the channel.TestPolicyChange: an accepted policy reaches the policy and gets aPolicyAck.TestServeStops: the end of the context, orwb-hostdclosing the channel, ends it without acontrol-message-refusedrecord. - Accounting channel (S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs., “Accounting and event channels”).
TestAccountingVersionRefused: another version record, or none within the version timeout, ends the channel.TestAccountingEnds: a recordwb-hostdsends after its version record, or a message with two descriptors, ends the channel withcontrol-message-refused, and later writes fail.
wb-netd
Section titled “wb-netd”- Start interface. In
cmd/wb-netdon macOS, the tests start the built program aswb-hostddoes, with no arguments, an empty environment, descriptors 2 to 6, and a fake guest on a datagram socketpair.TestChildServes: a flood of frames before the start is drained, DHCP leases the start message’s address, an allowed name gets a synthetic address only after its accounting record and its name report, and the confined process exits 0 when the control channel closes.TestChildRefused: an argument exits withnetd-arguments, and no descriptors or a stream socket as the transport, and an open descriptor above 6, exit withnetd-descriptor-invalid, each with status 1.TestChildTransportEnds: a guest end that closes endswb-netdwithnetd-failedand status 1, notnetd-stopped.TestFirstOpenFromininternal/platform/fdchan: the walk finds an open descriptor and skips a closed one.TestCloseOnExecFrom: a descriptor without close-on-exec gets it. After a descriptor refusal, the confinement has already denied a read outside the profile. - Drain before the start (S04-09-netd-startS04-09-netd-start: Starting `wb-netd`How wb-hostd starts and stops each VM's wb-netd, what the program inherits, its profile, and what it does before its start message., “Drain before the start”).
TestGateDrains: frames before the start message are read at once and dropped withlink-not-started, and the stack reads the frames after it.TestPolicies: before the first policy no name and no port is allowed (SEC05-default-denySEC05-default-deny: Default-deny egress, enforced on the hostOnly allowlisted hostnames are reachable.), and after it the policy’s are. - Started by
wb-hostd. Ininternal/hostd/netdprocon macOS, with the realwb-netd:TestC11NetdStartAndStopstarts it, sends the start message and the first policy, sees the acknowledgment, and at the stop sees it exit 0 withnetd-stopped.TestNetdEndedExits: awb-netdended withnetd-endedexits.TestStartRefused: a transport that can’t hand its descriptor on, a multicast or short MAC address, and a program that isn’twb-netdare each refused withnetd-start-failed.TestInheritedDescriptorNotPassed: a descriptor without close-on-exec inwb-hostdis marked withinherited-descriptorand doesn’t reachwb-netd, which starts.TestNetdStopTimeoutKills: a stoppedwb-netdthat doesn’t exit after the control channel closed is killed withnetd-stop-timeout. - The VM’s run (
internal/hostd/vm).TestC11NetdStartsAndStopsWithTheRun: the run’swb-netdgets the VM’s MAC address and transport, is stopped before the transport copy closes, and its open accounting runs are in the stop record.TestNetdStartFailedRefused: a failed start refuses the VM start withnetd-start-failed.TestNetdExitStopsTheVM: awb-netdthat exits during a run stops the VM withnetd-exited.TestNetdExitDuringStartStopsTheVM: awb-netdthat exits before the VM is running still stops it withnetd-exited.TestNetdExitDuringStopKeepsTheStop: an exit during a requested stop leaves that stop’svm-stoprule.TestNetdPreparedBeforeTheVM: the policy is loaded before the provider’s start, and a failed load refuses the start withnetd-start-failedbefore the VM starts.
Supervision
Section titled “Supervision”- Close each daemon’s control channel, and see
wb-netdandwb-proxydexit,wb-launcherend what it started and exit, and a fake VM provider stop its VMs. A hung fakewb-diskfmt’s child in its process group is killed too. - Kill request (S04-04-vm-processesS04-04-vm-processes: Per-VM ProcessesOne wb-vmd for each VM, the wb-vmd-layer entry of the Claude Code layer build, the wb-vmd-recipe entry of a named image's recipe, and wb-diskfmt, which formats a VM's new data disk., “
wb-diskfmt’s kill”). Askwb-launcherto kill an instance of another entry, an instance ID it never returned, and a reapedwb-diskfmt. See the first two logged withlauncher-kill-refused, the third answered as already exited, and nothing signaled in any. - Ask it to kill a hung fake
wb-diskfmt, and seelauncher-killlogged and the shim’s child in its process group stopped too. - On a fake clock, kill
wb-netdfive times in 10 minutes, and see:- the backoff;
- each new
wb-netdstart with the wildcard budget and the synthetic name mapping its predecessor left, a debit written just before the kill included; - no restart after the fifth exit;
- a session start then refused with
daemon-given-up.
- Run the same test with the VM’s audit event budget exceeded and its refusal events suppressed, and see every debit, every mapping entry and every release counted.
- Restart
wb-proxyd, and see every running VM get a new hand-off socket. - Send a running
wb-netda socket message with another VM’s generation, and see it refused and the control channel go on. Send it one with two descriptors, and see both closed and the control channel end (S04-07-supervisionS04-07-supervision: SupervisionWho starts and restarts each host process, what happens when wb-hostd stops or the bundle is upgraded, and daemon outages., “New hand-off sockets”). - The type that holds
wb-hostd’s copy of the packet transport descriptor has no read or write method (TestTransportHasNoReadOrWrite), and the copy is closed at VM stop and at a restore.
VM manager
Section titled “VM manager”Spec: S04-04-vm-processesS04-04-vm-processes: Per-VM ProcessesOne wb-vmd for each VM, the wb-vmd-layer entry of the Claude Code layer build, the wb-vmd-recipe entry of a named image's recipe, and wb-diskfmt, which formats a VM's new data disk., S06-07-slot-admissionS06-07-slot-admission: Slot AdmissionHow wb-hostd admits every macOS VM it starts against the limit of two, and lends the isolated VM's slot to a maintenance VM. (“Other software”),
S06-12-guest-agentS06-12-guest-agent: Guest AgentWhat wb-guestd, the service in the guest, does for the host, and how it updates itself. (“Guest tools disk”), S05-03-management-commandsS05-03-management-commands: Management CommandsThe commands of wb other than the agent commands.
(“wb vm”). Tests in internal/hostd/vm, with the fake provider and
cloner of internal/hostd/vm/vmtest:
- A start and a stop of each slot. A second start is refused with
vm-running, and a stop of a stopped VM withvm-not-running. - Refusing mode refuses a start with its rule, before any step.
- Managers that share one
state.dbgive strictly increasing generations, and the generation is committed before the provider sees it. Generation 0 is refused withvm-generation-invalidon start, stop and connect. A connection for any generation but the current one is refused withvm-generation-stale. Each run that reaches running is reported once toOnRunning, whose channel closes when the run ends. - A provider refusal is passed on with its rule. A start that fails on
the framework’s limit of running VMs is refused with
vm-limit-other-software, naming the running VM, with no retry. - A VM that stops on its own reaches stopped with its error kept, and
is logged with
vm-stopped-unexpectedly. Its stop record comes before the slot reads stopped, and a stop while the run ends is refused withvm-stopping. - A request stop that doesn’t finish in time goes to a force stop. A
provider that never answers a stop still ends the run, with the
instance closed once, and one that never opens or never answers a start
is refused with
vm-start-timeout. - While a stop runs, a second stop and a connection are refused with
vm-stopping, and a start withvm-running. Of concurrent starts of one slot, one opens an instance. A stop that raceswb-vmd’s exit closes the instance once. After a restart, every call goes to the new instance. - A provider rule that names one of the manager’s own rules is refused
with
vm-provider-failed, and the provider’s text is cut to 1 KiB. - A bundle path that is a symbolic link or a file is refused with
vm-bundle-not-directory, and one that can’t be created withvm-bundle-create-failed. - The configured resources reach the provider.
- MAC address and packet transport (S06-06-devices-and-warm-startS06-06-devices-and-warm-start: Devices, Warm Start and TimeA VM's devices and resources, saving and restoring its state, and how the guest clock follows the host.,
“MAC address”; S07-02-packet-pathS07-02-packet-path: Packet PathHow wb-netd carries the guest's frames: the packet transport, the stack, the link filter, its caps, addressing, the MTU and connections., “Packet transport”). In
internal/hostd/state, a slot’s MAC address is made once, is locally administered unicast, is kept across calls and restarts, and differs between slots. A new address that is another slot’s is made again, and an address in the database thatwb-vmdwould refuse is an error. In the manager, eachStartRequestcarries the slot’s address, the same on every start. A failure to get it is refused withvm-mac-failedbefore any provider instance opens. The transport is held while the VM runs and closed once when the run ends, by a stop or bywb-vmd’s exit. A transport that comes after the start’s deadline is closed. A start without one is refused withvm-network-missing, and the instance is closed. The type the manager holds it in hasCloseand no other method. - A stop with a fake session is refused with
vm-live-sessions, and the refusal lists it. - Tools disk, in a temporary directory with a cloner that copies:
tools.imgis replaced before each start. A symbolic link attools.imgto a file outside the bundle is replaced, with the target unchanged. A leftover temporary file is deleted. A clone failure refuses the start withtools-disk-clone-failed, and the temporary file is gone. An old copy with mode 000 is still replaced, which shows the manager never opens it (SEC15-no-guest-disk-mountSEC15-no-guest-disk-mount: The host never mounts a guest-written diskA disk image is guest-written once a guest has run with it attached, and every copy or clone of a guest-written image is guest-written too.).
Accounting and event channels
Section titled “Accounting and event channels”- Fail an event write with
ENOBUFSorEAGAIN, and see new work refused withevent-channel-blocked, and the record written once the retry succeeds. Ininternal/eventchan, on a fake clock:TestFailedWriteBlocksAndRetries,TestAdmitRefusesWhileBlocked,TestSlowWriteBlocks(a write past 100 ms),TestQueueCapStallsInput(a full queue stalls the caller, refuses new work and doesn’t drop a record),TestEmitOfBadFormCounts,TestControlTruncatedEndsReadsandTestUnencodedRecordRefusesForGood.TestRealChannelFullPeerBlocksfills a real socketpair, and sees every record arrive in order once the peer reads. - In
internal/hostd/events,TestRefusedRecordEndsSendersends records that don’t decode, break a bound, skip a sequence number, or name another VM, or hold a field the contract lacks at any depth, and sees each logged withevent-record-invalid, the sender ended, and nothing written. So doTestRepeatedSequenceEndsSender,TestDescriptorEndsSenderandTestProxydNamesVMThatNeverRan.TestRecvErrorsEndSenderends the sender withfdchan’s rule orevent-channel-failed, andTestRealChannelOversizeEndsSenderwithfdchan-record-sizefor a record over 4 KiB. - A sender that ignores its budget has its VM stopped, and
wb-proxyd’s channel is never held for a budget (S09-13-event-sendersS09-13-event-senders: Event SendersHow wb-hostd tells the senders of event records about the audit budgets, what it holds back, and when it stops a VM for its records., “The margin”).TestFloodStopsVMfloods a real socketpair with well-formed records that ignore every notice. It sees the audit writer’s queue stay at its cap, logged withevent-queue-full, the sender’s writes fail, then the VM’s run stopped once withevent-budget-ignoredat the margin’s end. The receiver then reads nothing the sender sends on until it is gone, and every record it sent is written. Inmargin_test.go,TestBudgetIgnoredStopsVMandTestBytesMarginStopsVMsee the stop and its log line with the rule and the sender, and the hold ofwb-netdafter it.TestStoppedNetdGetsTheAllowancesees awb-netdthat sends on read no more than the stop allowance, across a minute’s turn.TestMarginPerSendersees a flood of the work VM from itswb-netdstop that VM whilewb-proxyd’s records of the isolated VM are read, written, and neither held nor refused. TestProxydPastMarginStopsItsVMOnlyseeswb-proxyd’s records of a VM after its stop decision go the late way, the drops past the allowance counted in one record at the VM’s end.TestStopWithProxydQueuedstops the work VM whilewb-proxydholds queued records of it, and sees them written withevent-vm-endedandwb-proxydnot ended.TestLateRecordsPastAllowanceDroppedsees late records past the stop allowance dropped and logged, the count of the drops written at the next end and at the exit, andwb-proxydread on.TestLateDropsCountedOnTimersees the count of the drops written on the timer, each drop counted once.TestRecordsMarginPerMinuteUnderBytessees the records count start again each minute over the bytes budget.- With the real audit writer,
TestBytesMarginChargesLinessees the bytes past the budget at the stop within the margin and one line, and the stop allowance read after it.TestRecordsMarginUnderBytessees small records stopped at the margin’s records over the bytes budget.TestRecordCountedandTestForceStopRunininternal/hostd/audit, andTestAuditForceStopRunininternal/hostd/vm, see the counted bytes, and a stop reach the named run only. - A sender is held back while the audit writer holds its cap
(S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs., “Host work the guest can cause”). The
flood tests run on macOS only, because
fdchan.Socketpairis unsupported elsewhere, and the tests inhold_test.gocheck the hold on every OS.TestFloodStopWhileQueueFull,TestQueueFullReleasedWhenSenderGoneandTestSenderGoneWakesRecvsee a VM stop not wait for the hold.TestStoppingReadsTheAllowancesees the receiver read no more than the stop allowance past a hold, and log the rest withevent-stop-allowance.TestHoldLogLimitedsees a repeated hold logged at most once a second.TestStopReadsPastAFullQueueininternal/hostd/netdprocstarts awb-netdstand-in that fills its event channel while the audit writer holds its cap, and sees the stand-in exit on its own before the kill atStopTimeout, and the stop return its open run, with no record dropped at its close.TestQueueCapRoomandTestRoomOnCloseininternal/hostd/auditcheck the writer’s cap. - A
wb-netdthat ignores its stop gets no more than the stop allowance read (S09-13-event-sendersS09-13-event-senders: Event SendersHow wb-hostd tells the senders of event records about the audit budgets, what it holds back, and when it stops a VM for its records., “At a VM’s stop”).TestStopBoundsASenderThatIgnoresItininternal/hostd/netdprocstarts the stand-in built to keep sending after its control channel closes. The test kills the stand-in once it has written past the allowance plus the slack, and the stop returns and logs the drop withevent-stop-allowance, whileTestNetdStopTimeoutKillscovers the kill atStopTimeout.TestRoomCountsUnsyncedandTestRoomAfterFailedSyncAtCapininternal/hostd/auditsee the records written but not synced count against the writer’s cap, andRoomopen again once a failed sync at the cap is retried. - Send a mapping entry with an uppercase or non-LDH name, a trailing
dot, an address outside 198.18.0.0/15, one past 131,072 live
entries, or one whose name or address the VM holds for another. See
it logged with
mapping-entry-invalid, and thewb-netdthat sent it ended, as for a record received withMSG_TRUNC. Ininternal/hostd/egress:TestMappingEntryInvalid, with the bounds lowered. - See entries kept until their release record, with
wb-hostd’s receipt time:TestEntriesKeptUntilRelease.TestReleaseUnheldlogs a release of an address the VM doesn’t hold withmapping-release-unheld, and the mapping stays as it was.TestRepeatsCountOnceandTestLifetimecover repeated debits and names, a stop, a restore and a new active period. - The other records (S07-06-name-mappingS07-06-name-mapping: Name MappingHow wb-proxyd keeps its own checked copy of the names wb-netd gave synthetic addresses: name reports, releases, replay, lifetime, the second count of the wildcard budget, and the copy wb-hostd keeps., “Kept by
wb-hostd”). Ininternal/hostd/egress,TestRecordMalformedrefuses a record that doesn’t decode, has a descriptor, is of another sender’s kind, names a VM that wasn’t started, is a mapping entry fromwb-proxyd, or is a debit past the name bound, withaccounting-record-malformedand its check.TestProxydNamesServedVMkeeps aProxydWildcardNamefor a stopped VM, or one restored with no acknowledged hand-off socket, logged withproxyd-name-unserved, and drops one after a start that cleared the counts.TestStaleProxydNameDroppedsees the new run’s last name kept at the full budget.TestProxydNameAfterStopKeepsProxydreads such a name after a stop or a restart, and seeswb-proxydgo on serving the other VM. - The reader (S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs., “Accounting and event
channels”). In
internal/hostd/egress,TestReaderKeepsRecordskeeps records after the version record, and a sender that closes its channel ends nothing.TestRefusedRecordEndsSenderends the sender once, logged with the rule and check, and doesn’t read on.TestReaderVersionRefusedandTestVersionSendFailsend the sender for another version record, one with a descriptor, none within the version timeout, and one that can’t be sent.TestRecvErrorsEndSenderends it withfdchan’s rule as the check, oraccounting-channel-failed. Once the sender is gone, over a channel whose sender’s end never closes,TestSenderGoneDrainsandTestSenderGoneWakesRecvkeep what is queued and stop, logged withaccounting-sender-gone, andTestSenderGoneRefusedRecordstill ends the sender for a refused record.TestSenderGoneDrainBoundstops a drain that never empties afterDrainMaxrecords, logs the rest as refused, and closes the channel. Ininternal/hostd/netdproc,TestStopWithAccountingEndInFlightseesStopreturn within its bound while a copy ofwb-netd’s accounting end is in flight in an unread socket, and a write on that copy after the stop fails. wb-proxyd’s control channel (S07-05-stream-hand-offS07-05-stream-hand-off: Stream Hand-offHow wb-netd hands each stream to wb-proxyd, and the checks that keep a compromised wb-netd from widening what a stream may reach., “One hand-off socket per VM”, S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves., “Control channels”). Ininternal/hostd/egress, over a fake channel,TestHandoffAfterAckreturnswb-netd’s end only after theHandoffSocketAck.TestHandoffNoAck,TestHandoffProxydEnds,TestHandoffSendFailsandTestHandoffRefusedBeforeSendfail the start withproxyd-setup-failedand each check, with no end left open, and ignore a late acknowledgment.TestControlMessageRefusedandTestProxydVersionRefusedendwb-proxydwithcontrol-message-refusedor the version rule.TestHandoffSocketClosedends the VM’swb-netdonce withname-report-malformed, and logs a stale notice withhandoff-notice-stale.TestPolicyWaitsForAckwaits for thePolicyAck.TestHandoffNotStartedandTestHandoffPendingfail the start withvm-not-startedorpendingbefore anything is sent.TestHandoffRetryAfterTimeoutignores the late acknowledgment of a timed-out attempt and returns the retry on its own.TestPayloadWriteFailsendswb-proxydwithcontrol-channel-failedand the checkpayload-write.- Hand-off socket states (S07-20-handoff-socketsS07-20-handoff-sockets: Hand-off SocketsThe life of one VM's hand-off socket: its identity, the acknowledgments of both ends, how it closes, who a failure is charged to, what each restart does to it, and which of its decisions reach the audit log., S07-21-vm-endS07-21-vm-end: A VM's End in wb-proxydHow wb-hostd ends a VM's hand-off sockets in the one wb-proxyd, and how the VM's last event records reach its stop record without one VM's stop or backlog taking the other VM's network down.;
built in I728I728 (closed): Hand-off socket contract of S07-20: socket number, HandoffSocketHeld, states, close reports, and a VM's endBuilds the hand-off socket contract of S07-20-handoff-sockets and the end exchange of S07-21-vm-end (#754, PR #758) in one change, before #480. and I512I512 (closed): wb-proxyd: the program, its confinement and start, hand-off sockets per VM, and restartsPackage M3.12 of docs/implementation-plan.md, part 3 of 4 (M3.12c).). Over fake channels, in
internal/hostd/egress:- a
wb-netdthat withholdsHandoffSocketHeldfails the start withheld-timeout, and on a running VM is ended withhandoff-netd-ended; - an
ack-timeouton a running VM endswb-proxydwithhandoff-proxyd-ended, and nowb-netdrestart is counted; - after a
wb-netdcrash and restart, a lateHandoffSocketClosedfor the old socket is stale and doesn’t end the newwb-netd; - a
HandoffSocketAckorHandoffSocketHeldfor a number never offered, or a second one, is refused; - each rule of “Closing a socket” ends the daemon it is charged to, and the other VM’s socket goes on;
- at a VM stop,
HandoffSocketEndcomes beforewb-netd’s control channel closes, covers a socket that closed or failed first, and the VM’s events end only after the record its answer names; - a socket end and a stop end for the same number, after a failure
and a stop, a failed start socket and a refused start, or a
wb-netdexit just before the stop, each get their own answer, andwb-proxydgoes on; - no answer by the deadline ends
wb-proxydwithhandoff-end-timeoutand writesproxyd-records-lost; - a
wb-proxydthat exits with an end unanswered ends that wait, writesproxyd-records-lostand ends the VM’s events, and the newwb-proxydgets no end; - a stop answer whose sequence is below the last record read that
names the VM and generation is refused, a socket end’s answer with
a sequence other than 0 is refused, and a read that doesn’t reach
the sequence in time ends
wb-proxydwithhandoff-end-read-timeout; - with
wb-proxyd’s queue and socket buffer full under a hold, the honest stop answer, past the allowance by the end’s records, is accepted and read to its sequence; - an answer with a sequence past the read’s bound is accepted, the
read ends at its last sequence, and the cut is named in the stop
record. Later records of the generation at or below the named
sequence are dropped with
event-stop-allowanceup to the read’s bound, and one more, or one above the named sequence, endswb-proxydwithevent-record-invalid; - no
PolicyChangeorActivePeriodStartfor a VM, and no message that names its ended generation, goes out after its stop end; - a
wb-netdthat withholdsHandoffSocketHeldafter awb-proxydrestart doesn’t delay the other VM’s socket, and one VM’s stop end doesn’t delay the other VM’s acknowledgment; - a
wb-proxydrecord that names a VM and generation outside its window endswb-proxydwithevent-record-invalid.
- a
- Block an accounting write past 100 ms, and see the lookup refused
with
accounting-write-failed.
Daemon log pipes
Section titled “Daemon log pipes”Spec: S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs., “Logs and health”. Tests in
internal/hostd/logpipe, on a fake clock:
- 101 lines in one second write 100 lines and one
daemon-log-raterecord with the count 1. - A 5 KiB line is cut at 4 KiB with the truncation marker, and the next line is intact.
- A line with a quote, a control byte and invalid UTF-8 becomes one well-formed JSON record of the spawn’s process.
- Rotation at 10 MiB keeps 5 files.
- A blocked file write doesn’t stop the reader from draining the pipe.
The lines it drops are counted in
daemon-log-backlogrecords.
Host-guest socket
Section titled “Host-guest socket”Spec: S04-02-vm-providerS04-02-vm-provider: VM Provider and StreamsHow wb-vmd hands guest connections and the NIC endpoint to other processes, the fixed device set of a VM, and where wb-proxyd takes a stream's identity from. (“Guest ports below 1024”), S06-12-guest-agentS06-12-guest-agent: Guest AgentWhat wb-guestd, the service in the guest, does for the host, and how it updates itself. (“The port”, “The hello”).
- Listener (
internal/platform/guestsock, with a fake socket and clock). Failed accepts are skipped and the next host connection is served. A connection from CID 3 and one from CID 0 are closed and logged withguestd-peer-not-host. Each kind logs one record per 10 s window with the count held back.EADDRINUSEis retried from 100 ms doubling to 2 s withguestd-bind-in-use, andEACCESis returned at once withguestd-bind-failed. Port 1023 is below 1024. - Hello (
internal/guestlink). An empty version, one of 65 bytes, one with a control byte or a non-ASCII byte, another version, an answer over 4 KiB, a guest that never answers, one that answersUNIMPLEMENTED, and package lists that are empty, other, longer or out of form are each refused with their rule and the connection closed. A good answer passes, andwb-guestd’s Hello passes over a socketpair.
Guest update and clock
Section titled “Guest update and clock”Spec: S06-12-guest-agentS06-12-guest-agent: Guest AgentWhat wb-guestd, the service in the guest, does for the host, and how it updates itself. (“Update at start”), S06-06-devices-and-warm-startS06-06-devices-and-warm-start: Devices, Warm Start and TimeA VM's devices and resources, saving and restoring its state, and how the guest clock follows the host. (“Step or slew”).
- Update (
internal/guestupdate, with a fake platform and temporary directories). A disk ofwb-guestd’s own version doesn’t install anything. A disk of another version, and awb-guestdwithout a version, install every program with the disk’s bytes, mode 0755,wb-guestdlast, and run the installedwb-guestd. A link at a program’s name or at the temporary name is replaced, and its target left alone. AVERSIONthat is missing, empty, a link, a directory, over 64 bytes, ends in a newline or isn’t a version is refused withguestd-update-version-invalid. A program that is missing, a link, a directory or over the size cap is refused withguestd-update-program-invalid. Both refusals come before anything is installed. An installedwb-guestdthat holds the disk’s bytes already is refused withguestd-update-no-effect, and one that differs in any byte is replaced. The update reads the disk only through the directory that passed its check. Awb-guestdthat can’t be installed leaves the programs before it installed, and nothing runs. A disk that never passes its check is refused after the wait with the platform’s rule, and a stop during the wait ends it. - Tools disk and install directory (
internal/platform/guesttools). Only an APFS volume mounted read-only by root at the mount point passes. One mounted read-write, by a user, or of another file system is refused withguestd-tools-untrusted, and a path with no volume mounted on it withguestd-tools-not-mounted. A directory that is a link or a file, has another owner, or is writable by its group or by others is refused withguestd-install-dir-unsafe. So is a path with such a parent, before anything is made under it. One that can’t be looked at fails withguestd-install-dir-failed. Installers that make a missing directory at once all pass and check it (TestMakeDirRace). - Clock (
internal/guestd, with a fake clock over a socketpair).SetTimesteps the clock for a boot, a restore and a wake, and for a periodic update more than 1 s off either way, and slews it by the offset otherwise. A time of 0 or less and a reason that isn’t one ofTimeReason’s are refused withInvalidArgument, and leave the clock alone. A clock the OS doesn’t letwb-guestdset answersInternal. On the host,internal/platform/guestclockgetsEPERMas a user other than root.
Guest link
Section titled “Guest link”Spec: S04-02-vm-providerS04-02-vm-provider: VM Provider and StreamsHow wb-vmd hands guest connections and the NIC endpoint to other processes, the fixed device set of a VM, and where wb-proxyd takes a stream's identity from. (“The host opens every connection”, “Caps and
closing”), S06-11-reconnect-and-recoveryS06-11-reconnect-and-recovery: Reconnect, Loss and RecoveryWhat happens when the host-guest link drops, when a session is lost, and how a lost session's work is recovered or discarded. (“Reconnect”),
S06-06-devices-and-warm-startS06-06-devices-and-warm-start: Devices, Warm Start and TimeA VM's devices and resources, saving and restoring its state, and how the guest clock follows the host. (“When the host sends the time”),
S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs. (“Host work the guest can cause”, its row of
RPCs from wb-guestd). Tests
TestC11GuestLink* in internal/hostd/guestconn, with the VM manager,
the fake provider, a fake clock, and wb-guestd’s GuestService serving
the guest end of each socketpair:
- A good hello links on port 1023 of the current generation, and the time hook runs after it, then every 60 s.
- Time (
TestC11GuestLinkTime*). The first time call of a generation has the reason boot, and every later one periodic: after 60 s, and after a reconnect. The next generation boots again. A call that fails withDeadlineExceededorUnavailabledrops the link withguest-time-unanswered, and the link connects again after 0.1 s. Any other failure logsguest-time-failedand keeps the link. Either way the next call is a boot again.SendTime, the hook ofwb-hostd, makeswb-guestd’s clock step to the host’s time. - Data mount (
TestC11GuestLinkSendMount,TestC11GuestLinkMountRefused,TestC11GuestLinkMountTimeout; S06-05-disksS06-05-disks: DisksA VM's system disk and data disk: how the data disk keeps what the guest flushes, and how the guest mounts it., “Mounting the data volume”).SendMount, the hook ofwb-hostd, askswb-guestdto mount the recorded volume withfirst_mountset, records the first success instate.db, and asks again without it after a reconnect. A refusal by the guest, or a record that is missing, not formatted, or unreadable (guest-mount-record), keeps the link. Every session start is then refused with the rule and a message that nameswb vm stop. Only a refusal by the guest also nameswb vm reset-data. A mount left unanswered (guest-mount-timeout) or failed withUNAVAILABLE(guest-mount-unavailable) reconnects, and the next link asks again. A session start is refused withsession-no-linkfor another generation or without a link, and withsession-mount-pendinguntil the mount is answered, also after a reconnect (TestCheckSessionStartPending). - In
internal/guestlink(TestMountData*andTestMountRefusalHidesGuestText),MountDatatakes only aFAILED_PRECONDITIONwith oneErrorInfoin the guest’s domain whose reason is a listed rule ofwb-guestd. Anything else, an answer over 4 KiB included, isguest-reply-invalid, and the guest’s message is never shown. A call that fails withUNAVAILABLEisguest-mount-unavailable. The call’s deadline is 45 s. - Port 0, 22, 1022, 1024 and 65535 are refused with
guest-port-unroutedbefore the provider is asked. - Each cap refuses at its limit with its rule:
guest-conn-cap-vm,guest-conn-cap-project, andguest-reconnect-ratefor the 21st open in a minute. A connection that opens after its run ended is closed withguest-conn-stale. AfterClose, an open is refused withguest-links-closedbefore the provider is asked. - While every try fails, by a failed connection or a refused hello,
the waits are 0.1, 0.2, 0.4 s and so on up to 5 s. A guest that drops
the link after each hello gets 20 connections, then the link waits
for the window and logs
guest-reconnect-rateonce. - Closing the guest end logs
guest-link-droppedonce and reconnects after 0.1 s, the old connection closed, and grpc-go never asks the link’s dialer for a second connection (guest-redial-refused). - A VM stop ends the loop and closes every connection, and the next
start links to the new generation. No goroutine of the link, its
loop or a gRPC client transport is left after
Close.
The gRPC limits, in internal/guestlink:
TestOptionsSetEveryLimitandTestLimitsValues: the client and the server options of a guest connection set every limit explicitly.TestLinkNamesItself: the guest sees:authoritywb-guestdand the user agentwb-hostdwith grpc-go’s version, and no host path.- An answer over 64 KiB after the hello, and a request over 64 KiB to a server on a guest connection, are refused. One guest connection runs at most 16 requests at once.
- Over a socketpair, a test handler refuses past the rate with
guest-rpc-rateand past the bound of requests in flight per VM, over three connections, withguest-rpc-inflight. - A link closes itself and its connection when the connection leaves
READY, and its dialer refuses a second call withguest-redial-refused.
Build versions
Section titled “Build versions”- Have
wb-guestdreport another build version, a version string that isn’t ASCII, one longer than 64 bytes, and one not of the fixed form. Connect a host peer of another build version, and one of an unstamped build. See each refused before any other request, with the version escaped and cut in the log. The guest cases areTestHelloRefusesandTestHelloUnstampedHostininternal/guestlink, andTestC11GuestLinkVersionRefusedininternal/hostd/guestconn, which also checks that the link status keeps both versions forwb vm status. - Connect a host peer from a replaced bundle, and see
wb-hostdexit withbundle-replaced. An unreadable installed version doesn’t make it exit.
Audit writer
Section titled “Audit writer”- Exceed the per-class budget, and see no 5019, 2004, approval,
returned-work, store-access, VM or session record dropped, and
wb-netdandwb-proxydrefuse withaudit-budgetuntil the window turns. - Stop a VM with an open run of suppressed refusals, and see its count
in the stop record (
TestEndVMWritesOpenRuns,TestOpenRunsInStopRecord,TestOpenRunsPastTheCapAreWritten,TestEndForgetsTheVM). - Budgets:
TestEventsBudgetandTestBytesBudgetininternal/hostd/auditsee the rule and its end at the turn of the minute or day, with every record still written. That includes the 5019 and 2004 records past the budget.TestBudgetWithWriterininternal/hostd/eventswrites 6001 records and sees one notice that ends at the minute’s turn. Ininternal/eventchan,TestBudgetNoticeRefusesAndCountsandTestBytesNoticeRefusessee the sender refuse withaudit-budgetoraudit-bytesand write one run per minute, andTestInvalidNoticeIgnoredsees a notice for another VM ignored and logged.TestStatusAuditBudgetchecks both budgets inwb vm status. - In
internal/hostd/audit:TestClassesRequiredchecks each record against the OCSF 1.8.0 subset intestdata,TestNoCredentialFieldschecks that no record type can hold a credential, andFuzzGuestLabelfeeds guest labels.TestRetentionandTestRetentionMinimumdelete files by age only. - A failed write (
TestFailedWrite,TestFailedWriteOfNoVM,TestFailedWriteStopsQueued,TestLastingFailure,TestWriteGivenUp,TestFailedOpen): see the VM of the record and of every queued record stopped first, then theaudit-write-failedfinding, and starts refused until a write succeeds. - In
internal/hostd/vm(TestAudit*), a VM start is refused, or the VM stopped, when its record can’t be written. Ininternal/hostd/hostservice, a shell doesn’t open while the log refuses new sessions or its open record can’t be written (TestShellAuditRefusesOpen,TestShellAuditOpenNotWritten,TestShellNoAuditLog), andTestStatusAuditRefusalshows the refusal inwb vm status. Ininternal/hostd/kills,TestKillProcessesLeftandTestKillColdStopsee the 2004 records.
Free space
Section titled “Free space”- On a fake volume, drop the free space below the floor, and see the VM whose data disk grew stopped before any write fails, and the reserve allocated again once space returns.
TestFloor,TestReserve,TestReserveAllocateFailsandTestCanStartDiskininternal/hostd/audituse a fake volume.internal/platform/volspacereads a real one (TestStat,TestAllocate,TestAllocatedSparse,TestAllocatedLink).
Data disk steps
Section titled “Data disk steps”Spec: S06-13-data-disk-formatS06-13-data-disk-format: Data Disk FormatHow the host formats a VM's new data disk, the one exception SEC15-no-guest-disk-mount makes, and the checks before a VM starts with its disk., S04-04-vm-processesS04-04-vm-processes: Per-VM ProcessesOne wb-vmd for each VM, the wb-vmd-layer entry of the Claude Code layer build, the wb-vmd-recipe entry of a named image's recipe, and wb-diskfmt, which formats a VM's new data disk. (“wb-diskfmt”),
S05-03-management-commandsS05-03-management-commands: Management CommandsThe commands of wb other than the agent commands. (“wb vm reset-data”).
The steps, in internal/diskfmt, with a fake diskutil. In each case
the fake diskutil is never asked to attach a file at the final name
(SEC15-no-guest-disk-mountSEC15-no-guest-disk-mount: The host never mounts a guest-written diskA disk image is guest-written once a guest has run with it attached, and every copy or clone of a guest-written image is guest-written too.).
- Leave a temporary file, and see it deleted, never attached.
- Have the fake
diskutilreport another backing image path at the check after the attach, and at the check beforeeraseDisk. - Replace the temporary file with another file at the same path, or add a hard link to it, before the attach and before the format.
- Put a file at the final name before the rename.
- Ask for a size outside the bounds, and see
diskfmt-size-invalidbefore any file is made.
In each failure, see wb-diskfmt fail with the rule and the file at
the final name kept. A failure after the attach detaches that device,
and one before it detaches nothing.
cmd/wb-diskfmt:
- Start it with
WB_DISKFMT_SLOTunset, with an unknown value, with an argument, with its bundle missing, and with its bundle a symbolic link to the other slot’s. Seediskfmt-slot-missing,diskfmt-slot-unknown,diskfmt-arguments,diskfmt-bundle-missinganddiskfmt-slot-bundle-mismatchlogged beforesandbox_init. - Confined by its own profile, it refuses a size outside the bounds, a request out of order, and a peer of another build version. It can’t read another file of its bundle, such as the system disk.
TestHostFormat, opt-in withWB_DISKFMT_HOST_TEST=1and attended (I228I228 (closed): X08-data-disk follow-up: measure that a host-made data volume stays unencrypted and returns freed spaceX08-data-disk (PR #227) recommends option A: the host formats the data disk as APFS.): the steps with the realdiskutil, confined, on a bundle under.scratch/. See a formatted image at the final name with far fewer blocks than its size, a canonical volume UUID, no device left attached, and a read outside the bundle denied.- Each data disk name ends in an extension that DiskImageMounter’s
Info.plistdoesn’t claim.
wb-hostd, with a fake wb-diskfmt and a temporary state.db:
- Give it a file at the final name that
state.dbdoesn’t record as formatted, and a link there, and see the VM start refused withdata-disk-unrecordedand the file kept. Remove a disk recorded as formatted, and seedata-disk-missing. Nowb-diskfmtruns. - See the records written in the order of steps 7 and 9, and a crash
between the rename and step 9 refused at the next start with
data-disk-unrecorded. - Answer with a refusal of
wb-diskfmt’s own, one of another rule, a UUID not in canonical form and another name, and see each refused, with nothing recorded as formatted. - A second format or reset of a slot while one runs is refused with
data-disk-busy.
wb vm reset-data:
- Refused without a terminal, and with a flag. A declined confirmation
leaves the disk and its record as they were. While the VM runs,
wb-hostdrefuses withvm-running, and a start during a reset is refused withvm-resetting. - An accepted one deletes the old file, drops the record, and records a new disk with a new UUID. The log line holds the old and new UUID.
wb vm start, stop, suspend and status, in
internal/hostd/hostservice and internal/vmcmd:
- In refusing mode
wb-hostdrefuses every call ofHostServicewith its rule, and a refusal of the manager arrives as theErrorInforeason. Awbof another build version is refused before the service, andwbnames both versions. startexits 0 once the guest is linked. A refused hello and a link that isn’t up by the deadline exit 255, and leave the VM running.- A guest version with escape sequences prints without them, cut to
64 bytes (
FuzzGuestText).suspendis refused without a connection towb-hostd. A usage error exits 2.
Fuzzing
Section titled “Fuzzing”- What
wb-hostdkeeps of the accounting records,FuzzAccountingRecordsininternal/hostd/egress: sequences of records fromwb-netdandwb-proxyd, with and without a descriptor, between starts, stops, restores and acknowledged hand-off sockets. The kept state stays within the bounds, with one address per name and one name per address, each name in canonical form and each address in the range. A record with a descriptor is never kept (S07-06-name-mappingS07-06-name-mapping: Name MappingHow wb-proxyd keeps its own checked copy of the names wb-netd gave synthetic addresses: name reports, releases, replay, lifetime, the second count of the wildcard budget, and the copy wb-hostd keeps., “Kept bywb-hostd”). - The receive decision of the descriptor channels,
FuzzRecvDecision: at most one descriptor kept, and every other one closed (S07-05-stream-hand-offS07-05-stream-hand-off: Stream Hand-offHow wb-netd hands each stream to wb-proxyd, and the checks that keep a compromised wb-netd from widening what a stream may reach., “Message form”). - The accounting records (debits, mapping entries and releases) and the
event records
wb-hostdreads fromwb-netdandwb-proxyd(S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs., “Accounting and event channels”).FuzzAccountingRecordchecks that an accepted record has no descriptor, is of a kind its sender sends, has a canonical name, an address inside 198.18.0.0/15 and a VM slot, and encodes again within 4 KiB.FuzzEventRecordchecks that no record is written after a refused one, that every written record marshals, and that an accepted record has no unknown field, a known class, every field within its bound, and a VM its sender may name.FuzzBudgetNoticechecks that a sender takes no notice for another VM, of an unknown rule, or that ends more than 25 hours ahead. - The output filter of
wb-build-ssh,FuzzBuildSSHOutput: arbitrary output in arbitrary chunks, with the password placed anywhere in it. No log line holds the password or a part of it cut at a read or a line, and the total read stops at its bound (S04-05-helper-programsS04-05-helper-programs: Helper ProgramsThe programs that run once for an image build or a store operation: wb-guestadmin, wb-release-check, wb-download and wb-build-ssh., “What reaches the log”). - The host version record,
FuzzVersionRecord: no more than 69 bytes read, and an accepted record holds 1 to 64 printable ASCII bytes equal to the reader’s own version (S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves., “The version record”). - The daemon log pipes,
FuzzLogPipe: arbitrary bytes in arbitrary chunks. Each record is one JSON line with at most 4 KiB of input in its line field. The reader’s buffer doesn’t grow past its bound (S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs., “Logs and health”). - Every vsock RPC handler in
wb-hostd. The first isFuzzHelloResponseininternal/guestlink: a refused answer never yields a version, and an accepted one is 1 to 64 bytes of printable ASCII equal to the host’s own (S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs., “Withwb-guestd”). The second isFuzzGuestLinkthere: arbitrary bytes in arbitrary chunks from the guest end of a socketpair as the answer to the link’s open: the HTTP/2 preface, the settings, and the hello. The link ends linked or refused within its deadline, and never links to a version other than its own. The third isFuzzMountDataResponsethere: arbitrary bytes as the answer toMountDataand as its status details. A refusal names a listed rule orguest-reply-invalid, and its text doesn’t hold a control byte. - The control channels between
wb-hostdandwb-netdandwb-proxyd,FuzzControlMessage: each direction, with and without a descriptor. An accepted message has the descriptor its kind takes, a VM slot, a generation or sequence of at least 1, and encodes again within 4 KiB.FuzzPayloadreads arbitrary payloads and checks the start payloads: nothing accepted holds a name out of form, an address outside the range, or more entries or names than the bounds allow (S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves., “Control channels”). - What
wb-netdreads fromwb-hostdandwb-proxyd,FuzzNetdControlininternal/netd/hostlink: arbitrary records, with and without a payload pipe, on the control channel, the accounting channel and the hand-off socket.wb-netdsends no name report, release, stream or accounting record. Each channel gets its version record only, and the control channel onePolicyAckper policy applied (S07-05-stream-hand-offS07-05-stream-hand-off: Stream Hand-offHow wb-netd hands each stream to wb-proxyd, and the checks that keep a compromised wb-netd from widening what a stream may reach., “Message form”). - The stream framing that multiplexes guest requests on a host-opened connection, with the project each request is attributed to (S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves., B29-vsock-handoffB29-vsock-handoff: Can wb-vmd hand guest connections to our Go daemons as descriptors, also across a restore?Yes, with conditions.).
Status: Draft