Synod’s Windows machine is OpenVMM on WHP, run as the user
On Windows, Synod boots its guest in an unprivileged openvmm.exe that it
spawns under the user’s own token, on the Windows Hypervisor Platform (WHP).
There is no Host Compute System (HCS) call, no LocalSystem service, no
elevation and no VHD. The machine is the one macOS already boots: a raw
ext4 rootfs, a sparse raw session disk, the granted folder over virtio-fs,
vsock for every wire, and no network adapter. Exactly one process holds the
machine, and the process is the machine’s lifetime.
Supersedes
windows-hyper-v-backend (HCS,
Plan 9, VHD) and
windows-machine-broker (the
SynodMachineBroker service). Their premise stands: one folder and nothing
else, and an empty machine rather than WSL’s shared one.
Amended 2026-11-25. See hot-shared-folders. The machine boots with no folder; folders are shared and withdrawn while it runs. The premise becomes the folders the user chose, at most eight, and nothing else.
- No boot-time folder:
CreateVMcarries no virtio-fs device, andproto::Share,Machine.sharesandMachineFiles.folderare gone.ral.workspaceandBoot.workspaceare gone, andCONTRACTis 5.- The RPC surface adds
AddVpciDeviceandRemoveVpciDevice. Each folder is a virtio-fs device hot-added on VPCI, with tags<n>, the root in its plain spelling,metadataormetadata;ro, and an instance id derived injectively fromn; neither is ever reused within a machine.Devices, the machine’s half of sharing, keeps the boot RPC client for these calls, one at a time, beside the process and session disk. OpenVMM spawns them outside the serial path its other VM RPCs take, without their cancellation context, so it honours no deadline. Ours,PLUG_PATIENCE(15 s), is client-side, and its expiry is terminal: a call whose outcome is unknown (timeout, I/O failure, malformed answer) ends the machine with a checkedkill. AStatusanswer changed nothing. Teardown remains the process handle’s, never an RPC.- The mounts wire: at the end of boot the host dials the guest’s
MOUNTSport (1733) through theCONNECT/OKrelay, and keeps the connection. A failure isError::MountsUndialled.- “The public boundary is unchanged” no longer holds.
Hypervisor::boottakes no spec,Machinegainsmountandunmount, andvm-managerexportsShare,MAX_FOLDERS,MountError,UnmountError,StopEvidenceandWithdrawn.- Confinement: OpenVMM’s
VirtioFs.windows_options.user_token_namelets each share be served under its own access token. It is unused; it is a per-share route to the restricted-token follow-up below.
Context
HCS serves only administrators and Hyper-V Administrators. Joining that group
lets a user attach a physical disk and read beneath NTFS, so the broker ADR
moved the privilege into a LocalSystem service instead. That service was
the part of Synod most in need of review. It needed impersonation, a pinned
folder, socket duplication across processes, a versioned pipe protocol, a
machine-wide cache and a WiX fragment. Windows also had no host-to-guest dial,
so helper engines (ports::FACTORY) were unsupported there.
WHP is the hypervisor API that any user may call once the Windows Hypervisor Platform feature is on. OpenVMM (Microsoft, MIT) is a user-mode VMM over WHP that speaks VMBus storage and sockets, and virtio-fs over VPCI. Together they need no privilege at run time.
Decision
- One child process, OpenVMM, pinned and staged beside Synod.
- Version: OpenVMM is built from a pinned upstream commit with only the
WHP backend (
scripts/build-openvmm.ps1). - Staging:
openvmm.exeships besidesynod.exeas a Tauri bundle resource, with its licence andTHIRDPARTY-OPENVMMunderlicenses\. A checkout stages it intarget/openvmm/. - Resolution:
openvmm::available()looks besidecurrent_exe(), then in the checkout. It never searchesPATHor the granted folder, and it spawns by absolute path. - No new crates:
vm-managergains no third-party crate. The ttrpc framing and the protobuf encoding ofCreateVMare hand-written inopenvmm/{ttrpc,proto}.rs, with golden wire tests that run on Linux.
- Version: OpenVMM is built from a pinned upstream commit with only the
WHP backend (
- Refusals before boot, in order.
- WHP off:
WinHvPlatform.dllis loaded from System32 only, andWHvGetCapability(HypervisorPresent)is asked. A missing DLL, a missing entry point orfalsegivesError::HypervisorPlatformOff. Its text names the feature, theEnable-WindowsOptionalFeatureline and the restart. The installer never toggles Windows features. - No VMM: a missing
openvmm.exegivesError::NoVmm { looked_in }, likeNoGuestImage. - No fallback: there is no second backend to fall back to.
- WHP off:
- Raw disks, no VHD.
- Disks: both are on one VMBus SCSI controller. LUN 0 is the shared raw
ext4
rootfs.img, read-only. LUN 1 issession.img, writable. - Session disk:
lifecycle::SESSION_BYTES(8 GiB) is shared with VZ. On Windows,FSCTL_SET_SPARSEprecedesset_len, since NTFS otherwise zeroes 8 GiB eagerly. A volume that cannot mark a file sparse is refused asHostFile::SessionDisk. - Boot: the kernel boots directly (
HyperVGen2LinuxDirect, no UEFI), so both platforms boot a kernel, an initramfs and a command line.
- Disks: both are on one VMBus SCSI controller. LUN 0 is the shared raw
ext4
- The folder is VPCI virtio-fs with Linux metadata.
- Mount options: the tag is the boot command line’s
ral.workspace. The options aremetadatafor a writable grant andmetadata;rofor a read-only one, which virtio-fs enforces withEROFS. - Paths keep their meaning: OpenVMM is given every path in Windows’
ordinary spelling, and so are the sockets, the executable and the working
directory.
win::plainstrips\\?\and refuses withError::NoPlainSpellingunlessGetFullPathNameWreads that spelling back as itself. A name ending in a dot or a space, or a device name, would otherwise send the guest a different folder from the one granted. The temporary folder is checked once, since every session path is a plain name beneath it; its refusal,TempNoPlainSpelling, says to move it. - Contract 4:
guest_abi::boot::Export,ral.plan9andports::PLAN9are gone.Boot.workspaceis a tag, andCONTRACTis 4 (boot-contract-is-versioned). - amd64 kernel: gains
pci-hyperv,virtio_pci,virtiofsandfuse, and drops 9p. - NTFS dependence: Linux metadata (modes, ownership, symlinks) is kept
by OpenVMM’s
lxutil, which probes the host filesystem for the features it needs. A workspace on FAT, ReFS or a network share may lose metadata. NTFS is the supported case, and acceptance runs only there.
- Mount options: the tag is the boot command line’s
- Every wire is OpenVMM’s hybrid vsock relay over
AF_UNIX.-
The socket: OpenVMM binds
v.sockin the session directory. -
Guest to host: before
ResumeVM, Synod bindsv.sock_1729(control) andv.sock_1730(net). A guest connection to port p is relayed, raw, tov.sock_<p>. OpenVMM sees a listener only by whether the file exists, so a stale file would fail after the guest has opened the channel; the session directory is fresh every boot. -
Host to guest (
connect_guest,dial_engine):- Synod connects to
v.sockand writesCONNECT <port>\n. - It sends nothing more until
OK <id>\narrives, reading at most 64 bytes, one at a time, withinGUEST_DIAL_PATIENCE. - End-of-file without
OKisDialError::Unanswered { port }.
Helper engines therefore work on Windows, and
DialBackend::OpenVmmnames the backend. Every backend can now dial the guest, soDialError::Unsupportedand its fact are gone. The engine’s fact vocabulary changed with it (EngineFactoryFailuregainsdial-unansweredand losesunsupported;FactoryBackendisopen-vmmorvirtualization), soPROTOCOL_VERSIONis 50. - Synod connects to
-
The engine protocol’s stream: on Windows
WireStreamis std’sTcpStreamowning anAF_UNIXsocket. As before, the type makes no claim about the address family (engine-protocol).
-
- The Job Object is the machine’s lifetime, and power events end the
process.
-
The job: an anonymous, non-inheritable Job Object with
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSEand no breakaway. The child is placed in it at creation (PROC_THREAD_ATTRIBUTE_JOB_LIST), so it never runs outside it, even if Synod dies between two calls. It inherits exactly three handles (PROC_THREAD_ATTRIBUTE_HANDLE_LIST):NULfor stdin and stdout, and the openvmm log for stderr. Its environment holds onlySystemRoot,TEMPandTMP, and its working directory is the session directory. A Synod that dies, however it dies, takes OpenVMM with it. -
Readiness: Synod tries to connect to
r.sockeveryPULSE(50 ms), waiting on the process handle in between. The first connection that succeeds is the RPC stream; the session directory is fresh, so an acceptingr.sockis OpenVMM’s. An exit first is refused with its status and the openvmm log’s tail, andBOOT_TIMEOUTwith the last connect error. This departs from the plan, which read readiness from OpenVMM closing stdout: a process spawned elsewhere in Synod at the same moment can inherit an inheritable pipe end and hold that end-of-file back. -
RPC: the RPC surface is
CreateVMandResumeVM, nothing else. OpenVMM runs VM RPCs one at a time and ignores their deadlines, so a teardown made of RPCs could hang behind one stuck call. A process handle cannot. An I/O failure or timeout on either call is reported with OpenVMM’s exit status when it exits within two seconds. -
Killing:
TerminateJobObjectis checked, and the reap waits at most two seconds; droppingVmmdoes both, and closing the job handle is the backstop. A forced stop that fails is OpenVMM’s failure (VmmFailed), notForcedStop. -
Power events:
GuestPowerActionsturns every guest power event into process exit, as follows. Any other code is OpenVMM’s own failure.Event Exit code Meaning to stop_withinshutdown EXIT_SHUTDOWN= 0stopped reset EXIT_RESET= 64an error naming the event crash EXIT_CRASH= 65an error naming the event watchdog EXIT_WATCHDOG= 66an error naming the event -
Stopping: the guest stops from inside. Every caller closes the wires first, which starts PID 1’s
halt().stop_withinthen waits for the exit code and, pastSTOP_GRACE, terminates the job (ForcedStop). -
Before the wires: a power event before both wires are dialled is
Error::EndedBeforeDial, carrying thePowerEvent. A boot that simply never dials isUndialled, whose likely cause is chosen per wire. Both quote the console and name the openvmm log, since OpenVMM can drop a failed VM worker while its RPC process lives on.
-
- One session directory, with a 107-byte
AF_UNIXbudget.- Contents:
SessionDisk::createmakes<temp>\ral-vm-session-<epoch>-<pid>-<rand>\on both platforms. It holdslease,session.img,r.sock,v.sockandv.sock_<port>. - Private from creation: on Windows
CreateDirectoryWis given a protected DACL (SYSTEM, Administrators, the owner), so no handle can be opened before it holds; on Unix the directory is made with mode0700. - Path budget: Synod binds and connects only to socket paths of at most
107 UTF-8 bytes. A longer path is
Error::SocketPathTooLong { path }, whose text names the limit and the remedy: point bothTMP(which Windows reads first) andTEMPat a short folder of the user’s own on NTFS. The sparse-volume refusal gives the same remedy. OpenVMM’s own paths are relative to its working directory, so they never meet the limit. - Cleanup: one predicate recognises our socket entries: the names
r.sock,v.sockandv.sock_<digits>, each anIO_REPARSE_TAG_AF_UNIXreparse point.SessionDisk’sDropand the start-up sweep both use it, so a clean stop leaves nothing and a crashed one is reclaimable.
- Contents:
- The console is a named pipe that Synod serves and OpenVMM opens.
- The pipe: it is created before
CreateVM, with an owner-only DACL andPIPE_REJECT_REMOTE_CLIENTS. Dropping aConsolewakes its pump, so no refusal leaks one. - The logs: the console log and
synod-openvmm-<id>.log, OpenVMM’s stderr, live in the user’s own%LOCALAPPDATA%\Synod\Machine. The machine exists only once both wires are dialled, so a failed boot keeps both logs by construction; only a clean stop discards them, since a refused stop may name either. Both are swept by the console log’s sweep (guest-console-outlives-stdout).
- The pipe: it is created before
The accepted trade-off
OpenVMM’s device emulation (virtio-fs, storvsp, VMBus) runs in a process that carries the user’s full token.
- Under HCS, the worker ran as a per-VM virtual account that could reach only what was granted to it.
- Under VZ, the machine runs in Apple’s sandboxed XPC service.
- Here, an escape from the guest into OpenVMM reaches every file the user can, which is weaker than “one folder and nothing else” at the host boundary.
What this buys is the absence of any privileged component. The broker’s
physical-disk escalation is gone, because a user token cannot open
\\.\PhysicalDrive*, and there is no SYSTEM service left to review.
Follow-up: confine openvmm.exe with a restricted token, low integrity
or an AppContainer, so that its reach is the granted folder, the media and
the session directory. This is not yet done.
Alternatives considered
- Keep HCS behind the broker. It is correct, but a privileged service is the most expensive thing Synod ships to review, and it still had no host-to-guest dial.
- HCS with the user in Hyper-V Administrators. Rejected by the broker ADR for the physical-disk escalation, and that reason still holds.
- Teardown by RPC (
ShutdownVM,TeardownVM,Quit). OpenVMM serialises these calls and ignores their deadlines. The exit code says the same thing and cannot hang. - A shutdown integration-component request, or a guest
poweroffshim. Both race the inside-out halt that every caller has already started. The shim also needed an externalkilland a shell script. PID 1’shalt()already powers off, and blocked signals are never dropped for it. - A separate runtime directory for sockets. No sweep could reclaim it, because it had no epoch in its name and its sockets are reparse points. One session directory, with one predicate, is reclaimable.
Consequences
- Removed:
vm-manager/src/{hcs,broker}/,os_path.rs, thesynod-machine-brokercrate,synod/wix/, the brokerjustrecipes,serde/serde_jsoninvm-manager, the VHD wrap, the machine-wide%ProgramData%cache,HcsGrantVmAccess, and every broker refusal (ServiceUnlocated,VersionSkew,NotPermitted,Folder*). NoBackendnow names WHP.- The installer carries
openvmm.exeas a resource and registers nothing.NOTICEandpackaging/README.mdrecord OpenVMM’s MIT licence, and the build generatesTHIRDPARTY-OPENVMMwith cargo-about from the exact graph it compiles, adding the in-source attributions cargo-about cannot see (Firecracker and Chromium OS in the ELF loader,fuse.h, Google’s RPC protos). - Memory: guest RAM is a pagefile-backed section committed at boot. The
working set grows lazily, but the commit charge is the full
SIZE(6 GiB) from the start. - macOS changes only through shared code:
CONTRACT4, which forces an arm64 media rebuild, plusSESSION_BYTESand the sharedlifecycleanderroredits. - The public boundary is unchanged:
Hypervisor::boot,Booted,Wires,SocketandMachine.SIZEstays 4 vCPUs and 6144 MiB, with the vCPUs clamped to host parallelism.
Where
vm-manager/src/openvmm/mod.rsdeclares the modules:proto,relayandttrpccompile whereveropenvmmdoes, so their tests run on Linux; the rest is Windows-only.vm-manager/src/openvmm/hypervisor.rshasOpenVmm,available, the guest andDevices, its half of folder sharing.vm-manager/src/openvmm/proto.rshascreate_vm,Machine,Disk,add_vpci_virtio_fs,remove_vpci,instance_id, theEXIT_*codes andexit, their meaning.vm-manager/src/openvmm/relay.rshas theCONNECT/OKhandshake.vm-manager/src/openvmm/ttrpc.rshasClient,MethodandFailure;Timedlives invm-manager/src/shares.rs.vm-manager/src/openvmm/process.rshas the job, the spawn, readiness andkill.vm-manager/src/openvmm/afunix.rshas WinsockAF_UNIXand the budget.vm-manager/src/openvmm/console.rshas the console pipe and logs.vm-manager/src/openvmm/win.rshasplain,document_text, sparse creation andprivate_directory.vm-manager/src/lifecycle.rshasSessionDisk,SESSION_BYTES, the socket predicate and the sweep.vm-manager/src/dial.rshasDialBackend::OpenVmmandDialError::Unanswered.vm-manager/src/error.rshasHypervisorPlatformOff,NoVmm,SocketPathTooLong,NoPlainSpelling,EndedBeforeDial,VmmFailedandPowerEvent.guest-abi/src/boot.rshasCONTRACT;guest-abi/src/ports.rshasMOUNTS.- Staging:
scripts/build-openvmm.ps1,synod/tauri.bundle.windows.conf.jsonandpackaging/about/.
See also
windows-hyper-v-backend and windows-machine-broker (what this replaces, and the premise it keeps), the-vm-crates-are-layered, session-disk-outlives-its-machine, guest-console-outlives-stdout, boot-contract-is-versioned, engine-protocol, two-enforcers (the machine is the outer ceiling), synod.