Skip to content

[MOCA SBX] Per-VM Unix-socket listeners handed over at run time (SCM_RIGHTS), with a control channel #1477

Closed

Description

@pdettori

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

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

  1. 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?
  2. Should the control protocol live in Cortex, or in a MOCA-provided plugin linked into a downstream build (the build-tag model allows that)?
  3. How does a dynamic listener get its pipeline: the same outbound pipeline with a per-listener identity, or a pipeline per binding?
  4. 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.

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions