Skip to main content

Module sandbox_fs

Module sandbox_fs 

Source
Expand description

Per-sandbox VFS composition + serve (FS-D, #365).

This is the end-to-end integration that ties FS-A/FS-B/FS-C together for the Worker GA filesystem: for each sandbox it builds a private VFS Namespace, composes the image filesystem + injected mounts into it, and serves it over a per-sandbox Unix socket that the Cloud Hypervisor guest attaches as a virtio-fs ShareFs device.

  per-sandbox flow (one per sandbox, fully isolated)

  RafsStore (shared, RO)         injected mounts (per-sandbox)
       │                          /stream  (StreamMount)
  image_fs_for(...)      ──┐      /models  (SyntheticMount)
  (ImageFs: RAFS lower +  │      /deltas  (SyntheticMount)
   per-sandbox writable   │          │
   upper, OverlayFs)      ▼          ▼
                      Namespace::fork() + bind_mount  (FS-C)
                             │  bound to this sandbox's Subject
                             ▼
                      VfsFileSystem (FS-A down-adapter, Subject-per-call)
                             ▼
                      serve() on  <sandbox>/vfs.sock   (FS-A vhost-user-fs)
                             ▼
                      attach_share_fs  →  CH ShareFs device  (kata_backend)

§Tenant isolation (#365 / #353 / #319 / #328)

Each sandbox gets its own forked Namespace, its own writable rootfs upper, its own injected-mount registries, its own socket, and is served under its own Subject. Sandbox A’s namespace contains only A’s rootfs and injected paths; it has no mount for B’s rootfs or B’s injected registries, so A cannot name — let alone read — B’s tree. The Subject is threaded into every VFS op as the policy/audit principal at the Mount boundary.

§Fail-closed

Composition hard-errors if the rootfs cannot be built (missing RAFS bootstrap, etc.); we never serve a partially-composed namespace. The injected mounts are read-only except /stream/{topic}/ctl.

Structs§

InjectedMounts
The injected mounts composed into a sandbox’s namespace, plus the handles the runtime keeps to feed them at runtime.
SandboxFs
A fully composed, per-sandbox VFS: the namespace, its Subject, and the runtime handles for the injected mounts.
SandboxFsLocalMount
A running per-sandbox VFS FUSE mount at a host directory: the non-VM sibling of SandboxFsServer (Model B, #715).
SandboxFsServer
A running per-sandbox VFS server: owns the socket path and injected handles.

Constants§

VFS_SOCKET_NAME
File name of the per-sandbox VFS socket under the sandbox dir.