fuse: add host FD passthrough for external FUSE servers#13426
Open
manninglucas wants to merge 1 commit into
Open
fuse: add host FD passthrough for external FUSE servers#13426manninglucas wants to merge 1 commit into
manninglucas wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
e2f45be to
cf5fce8
Compare
When a FUSE filesystem is mounted with an fd that is a host file descriptor (imported via fdimport) rather than an in-sandbox /dev/fuse DeviceFD, use a new host passthrough connection that reads and writes FUSE protocol messages directly to the host FD. This enables a FUSE server running outside the sandbox to serve filesystem requests for processes inside the sandbox. The sentry detects the host FD via a HostFD() interface check in GetFilesystem, creates a hostConnection that performs synchronous I/O over the FD, and routes all FUSE Call/CallAsync operations through it. Changes: - Add hostConnection type with synchronous Call/CallAsync/InitSend over a host FD (pkg/sentry/fsimpl/fuse/host_connection.go) - Add fuseCall/fuseCallAsync dispatch methods to filesystem that route to hostConn when set, falling back to the existing queue-based connection - Detect host FDs in GetFilesystem via a HostFD() interface and branch to getFilesystemHostFD which creates the host connection and performs FUSE_INIT synchronously - Add HostFD() method to host.fileDescription - Add unit tests using socketpair-based mock FUSE servers - Add integration tests with a full FUSE protocol server backed by a real host directory (INIT, LOOKUP, OPEN, READ, WRITE) - Add fuse_host test runner binary, --fuse-host runner flag, add_fuse_host defs.bzl support, and C++ syscall tests
cf5fce8 to
90803ce
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hostConnectiontype that performs synchronous FUSE protocol I/O over a host file descriptor, enabling FUSE servers running outside the sandbox to serve filesystem requests for processes insideGetFilesystemvia aHostFD()interface check and branch to a newgetFilesystemHostFDpath that creates the host connection and performsFUSE_INITsynchronouslyCall/CallAsyncoperations throughfuseCall/fuseCallAsyncdispatch methods onfilesystemthat forward tohostConnwhen setTest plan
host_connection_test.go): basic echo call, FUSE_INIT handshake, async call, not-connected error — all using socketpair-based mock servershost_connection_integration_test.go): full FUSE protocol lifecycle (INIT → LOOKUP → OPEN → READ → RELEASE and WRITE → verify backing file) with a real temp directory-backed FUSE serverfuse_host.cc):StatRoot,ReadFile,WriteAndReadBack— exercised via the_fuse_hosttest runner variant with host-sidefuse_hostserver binary🤖 Generated with Claude Code