Skip to content

fsgofer: add extension interface for custom backends#13216

Merged
copybara-service[bot] merged 2 commits into
masterfrom
test/cl918225708
May 20, 2026
Merged

fsgofer: add extension interface for custom backends#13216
copybara-service[bot] merged 2 commits into
masterfrom
test/cl918225708

Conversation

@copybara-service
Copy link
Copy Markdown

fsgofer: add extension interface for custom backends

Building a custom gofer (e.g. for network-backed storage, encrypted filesystems, or tiered caches) currently requires forking the runsc binary and copying/maintaining unexported setup and seccomp code. This adds an Extension interface that lets custom filesystem backends register with the stock gofer and serve LISAFS connections for specific mounts without forking.

This builds on #13180, which moved LISAFS implementation selection and connection options to the connection. With that in place, custom backends can plug into the stock gofer without creating separate lisafs.Server instances. All mounts continue to share one lisafs.Server, preserving the server-side filesystem tree and synchronization across stock and extension-backed mounts.

Registered extensions are queried in order for each mount. NewConnection returns a nil lisafs.ConnectionImpl to decline a mount, and the first extension that returns a non-nil implementation handles it. NewConnection receives the sandbox's OCI runtime spec, the specific *specs.Mount being served, the resolved mount path, and readonly state, so extensions can read sandbox-wide configuration from spec.Annotations and per-mount configuration from the mount itself without a side channel.

Stock fsgofer remains the default when no extension claims a mount. Extensions only choose the per-connection lisafs.ConnectionImpl and lisafs.ConnectionOpts now supported by lisafs.Server.CreateConnection. SeccompRules lets extensions declare additional syscalls, merged with the stock gofer allowlist before installation.

There are no behavior changes when no extensions are registered.

Also adds documentation in g3doc/user_guide/filesystem.md and pkg/lisafs/README.md describing how to use the extension interface.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#12950 from shayonj:s/gofer-backend-v2 7139233

Building a custom gofer (e.g. for network-backed storage, encrypted filesystems, or tiered caches) currently requires forking the runsc binary and copying/maintaining unexported setup and seccomp code. This adds an Extension interface that lets custom filesystem backends register with the stock gofer and serve LisaFS connections for specific mounts without forking.

The interface follows the socket.Provider-style registration pattern: NewConnection returns a nil lisafs.ConnectionImpl to decline a mount, and the first registered extension that returns a non-nil implementation handles it. NewConnection receives the sandbox's OCI runtime spec, the specific mount being served, the resolved mount path, and readonly state, so extensions can read sandbox-wide configuration from spec.Annotations and per-mount configuration from the mount itself without a side-channel.

Stock fsgofer remains the default when no extension claims a mount. All mounts still share one lisafs.Server; extensions only choose the per-connection lisafs.ConnectionImpl and lisafs.ConnectionOpts now supported by lisafs.Server.CreateConnection. SeccompRules lets extensions declare additional syscalls, merged with the stock allowlist before installation.

Zero behavior change when no extensions are registered: the stock fsgofer path runs unchanged, identical to today. This follows the same pattern as the network plugin: inactive when not configured, no impact on the default path.

New package runsc/fsgofer/extension defines the Extension interface and registration. The gofer command iterates registered extensions for each mount before falling through to fsgofer. The seccomp filter install path accepts extra rules for merging extension rules with the stock allowlist.

Also adds documentation in g3doc/user_guide/filesystem.md and pkg/lisafs/README.md describing how to use the extension interface.
@copybara-service copybara-service Bot added the exported Issue was exported automatically label May 20, 2026
@copybara-service copybara-service Bot force-pushed the test/cl918225708 branch 2 times, most recently from 8c4dc0b to ee7cb50 Compare May 20, 2026 16:44
@copybara-service copybara-service Bot merged commit a2521a9 into master May 20, 2026
@copybara-service copybara-service Bot deleted the test/cl918225708 branch May 20, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants