Skip to content

fuse: add host FD passthrough for external FUSE servers#13426

Open
manninglucas wants to merge 1 commit into
masterfrom
lucasmanning/fuse-host-passthrough
Open

fuse: add host FD passthrough for external FUSE servers#13426
manninglucas wants to merge 1 commit into
masterfrom
lucasmanning/fuse-host-passthrough

Conversation

@manninglucas

Copy link
Copy Markdown
Contributor

Summary

  • Add hostConnection type 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 inside
  • Detect host FDs in GetFilesystem via a HostFD() interface check and branch to a new getFilesystemHostFD path that creates the host connection and performs FUSE_INIT synchronously
  • Route all Call/CallAsync operations through fuseCall/fuseCallAsync dispatch methods on filesystem that forward to hostConn when set

Test plan

  • Unit tests (host_connection_test.go): basic echo call, FUSE_INIT handshake, async call, not-connected error — all using socketpair-based mock servers
  • Integration tests (host_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 server
  • Syscall integration tests (fuse_host.cc): StatRoot, ReadFile, WriteAndReadBack — exercised via the _fuse_host test runner variant with host-side fuse_host server binary
  • Existing FUSE tests pass (no regressions to the DeviceFD path)

🤖 Generated with Claude Code

@google-cla

google-cla Bot commented Jun 11, 2026

Copy link
Copy Markdown

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.

@manninglucas manninglucas force-pushed the lucasmanning/fuse-host-passthrough branch 3 times, most recently from e2f45be to cf5fce8 Compare June 12, 2026 18:11
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
@manninglucas manninglucas force-pushed the lucasmanning/fuse-host-passthrough branch from cf5fce8 to 90803ce Compare June 12, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant