virtio-vsock provides a way for applications running on a guest VM and the host system to communicate with each other using the standard socket interface (
socket,connect,bind,listen,accept). It defines a new socket address family (AF_VSOCK) and uses a (context id, port) pair of integers for identifying processes. The host system always has 2 as its context id while each guest VM is assigned a unique context id on startup.
It was first suggested in #32802 (comment):
I’m dockerizing Sjors ’s Stratum V2 sidecar (
bitcoin-mine) such that it’s able to reach a Bitcoin Core node running on the host.
My host is macOS, and Docker is Linux, which means they don’t have a shared kernel and their Unix socket descriptors don’t match.
It shouldn’t be too hard to support
AF_VSOCK(virtio sockets) for communication between vm host and guest processes. These should be more secure and more performant than TCP sockets.
Perhaps it’s useful for RPC too.