You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[MOCA SBX] Per-VM Unix-socket listeners handed over at run time (SCM_RIGHTS), with a control channel #1477
Priority: P0 (shape A; in shape B, MOCA's front end owns this) · Part of the Cortex × MOCA SBX epic · #905 breakdown step 3 covers Unix sockets only · MOCA contract: MI1 §8.3, control.proto
Problem
SBX microVMs have no network. Each VM's egress lands on its own Unix socket on the host. That socket is created by MOCA's pool manager (vmpool) when a standby VM is prepared, and it is handed to the proxy at run time. The descriptor is the identity: the proxy knows which VM is calling by which listener accepted the connection (this is what issue 1 builds on). VMs come and go every few seconds, so listeners must come and go too, without a restart.
What Cortex does today
Every listener is TCP:
bootstrap.go:88 (net.Listen("tcp", …)), also :138, :185, :214;
There is no control channel. The session API is read-only and unauthenticated.
What MOCA needs
A control socket (/run/moca-egress/control.sock, mode 0600) that admits only the configured microvm-worker and relay Unix users, checked by SO_PEERCRED.
Length-prefixed protobuf messages:
Register{vm_id, sid, grant, listen_fd} (the fd travels by SCM_RIGHTS);
Rebind{sid, grant};
Unregister{vm_id}, which ends that VM's in-flight requests with a counted error and exactly one aborted audit event per connection.
After a proxy restart, vmpool re-sends Register for every live VM. The proxy must accept that and hold no state of its own across restarts.
Design questions
Is a listener per VM (thousands over a day, tens live at once) acceptable in Cortex's listener model, or do we want one accept loop over many fds?
Should the control protocol live in Cortex, or in a MOCA-provided plugin linked into a downstream build (the build-tag model allows that)?
How does a dynamic listener get its pipeline: the same outbound pipeline with a per-listener identity, or a pipeline per binding?
Shutdown and drain semantics when Unregister arrives mid-request.
Done when
MOCA conformance cases identity_from_connection (registration path), unregister_aborts_inflight and grant_refused_under_single pass, driven by the suite's fake vmpool.
Activity
fix: bind TLS-bridged requests to their VM, and close the hook race (#…
fix: File pre-hydration refusals under the VM's own session (#1477)
test: Poll for the bridged request's audit line instead of racing it (#…
fix: File opaque VM tunnel rows under the VM's own session (#1477)
Feat: Per-VM socket handover and control channel for MOCA SBX (#1569)