Repository navigation
SHARD-213: drive Virtualization.framework through a per-VM shim the daemon re-adopts by socket - #177
Merged
Merged
Conversation
presmihaylov
commented
Sep 19, 2026
presmihaylov
commented
Sep 19, 2026
presmihaylov
commented
Sep 19, 2026
presmihaylov
commented
Sep 19, 2026
presmihaylov
commented
Sep 19, 2026
presmihaylov
commented
Sep 19, 2026
presmihaylov
commented
Sep 19, 2026
presmihaylov
commented
Sep 19, 2026
presmihaylov
force-pushed
the
shard-232-guest-kernel
branch
from
September 19, 2026 17:59
ec610f9 to
42b0950
Compare
presmihaylov
force-pushed
the
shard-213-vz-driver
branch
from
September 19, 2026 18:07
0ba3f75 to
d667a40
Compare
…aemon re-adopts by socket pkg/vz is the thin driver: a Config, the bounds and host probes on every platform, and the darwin VM assembly behind a build tag. cmd/shard-vz-shim holds one VM and answers the verbs over a length-prefixed unix socket, so a daemon restart re-adopts a running VM instead of losing it, and the framework's two-VMs-per-process ceiling never binds. The darwin tests boot a fixture PID 1 from the shard kernel, prove it answers over vsock, save and restore under the same identifier, and re-adopt a VM whose starter was killed. The restore test skips when the login session is locked: the helper unwraps the saved state with a Secure Enclave key that a locked screen withholds (Code=12, permission denied).
…s, a claimed socket, and bounded socket calls - A zero memory request boots on 512 MiB, as the docs promise, not the framework's 4 MiB minimum. - The VM retains every *os.File behind a device and closes them after the VM ends, so a collection in the shim cannot close a live descriptor. - The shim claims its socket before the boot: a live owner is refused, and Start refuses an answer from a pid it did not start. - Every client call is bounded, dial to reply, and a connect stream clears the deadline once the handshake is in. - Serve bounds the handshake and closes the connections still in it when the listener closes.
…every handshake, and say what a zero memory means The guest fixture now writes to /dev/hvc0: on macOS 26 a write to /dev/console never reaches the host console file, and the GC regression read it.
presmihaylov
force-pushed
the
shard-213-vz-driver
branch
from
September 19, 2026 18:16
d667a40 to
e3c7b27
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SHARD-213. Fourth of the M10 stack, stacked on #176.
Why. M10 needs a Virtualization.framework driver that survives a daemon restart and stays under the framework's two-VMs-per-process ceiling.
How.
cmd/shard-vz-shim/main.goandpkg/vz/server.go: one detached shim per VM, one length-prefixed JSON request per unix connection;connectsplices a vsock stream onto it.pkg/vz/client.gokeeps no connection between verbs, so re-adopting a VM is only dialing its socket.machine_darwin.gofollows hypeman's device assembly (NOTICE). Save and restore are darwin arm64 only; elsewhereErrUnsupported.DefaultMemory, not the 4 MiB floor. Out of range is refused, never clamped.Code=12, permission denied, spike item 9).What.
pkg/vz,cmd/shard-vz-shim,make build-shard-vz-shim. Darwin tests passed on nairiclaw.