Skip to content

fsmount: mount FUSE directly as root so file sharing works on Ubuntu 26.04 runners - #21

Draft
neilverc wants to merge 1 commit into
mainfrom
fsmount-direct-mount
Draft

neilverc wants to merge 1 commit into
mainfrom
fsmount-direct-mount

Conversation

@neilverc

Copy link
Copy Markdown

bridge intercept now calls mount(2) directly when it runs as root, so file sharing works on Ubuntu 25.04+ hosts, including GitHub's current ubuntu-latest.

Why

Since ubuntu-latest moved to Ubuntu 26.04, no bridge FUSE mount comes up in the devcontainer. The vercel/api Managed Drives E2E with added diagnostics (vercel/api#114289, job 137931066030) logs this for every path in BRIDGE_MOUNT_PATHS:

fusermount3: mount failed: Permission denied
WARN Failed to FUSE-mount path; skipping path=/var/run/vsm/ca error="fuse mount \"/var/run/vsm/ca\": fusermount exited with code 256"

In the same container /dev/fuse exists and CapEff includes CAP_SYS_ADMIN. The mount fails only in the setuid helper.

Ubuntu 25.04+ ships an AppArmor profile that attaches to fusermount3 by path. That includes the binary inside a container started with apparmor=unconfined, so the profile denies these mounts (moby/moby#50013). Intercept only logs a warning and continues, so pod files such as /var/run/vsm/ca/ca.crt and the secrets-init /usr/share/.env never appear in the devcontainer. This had gone unnoticed until staging switched to TLS VSM (vercel/api#107140), which made the app require /var/run/vsm/ca/ca.crt.

Approach

Intercept runs as root with CAP_SYS_ADMIN and doesn't need the setuid helper. Setting go-fuse's MountOptions.DirectMount when euid == 0 skips fusermount3 and the AppArmor profile attached to it. go-fuse still falls back to fusermount if the direct mount fails. Unmount also tries syscall.Unmount first, so shutdown needs no helper either. Non-root callers keep the current behavior.

Validation

  • go vet and go test ./pkg/fsmount/... pass.
  • Docker repro: a bridge server container, plus a typescript-node:24 devcontainer with SYS_ADMIN, /dev/fuse, and apparmor:unconfined. fusermount3 is replaced with a stub that prints the AppArmor denial and exits 1.
    • Before (main): all 6 mounts fail with the exact CI error, and /var/run/vsm/ca is empty.
    • After (this branch): all 7 mounts come up (6 paths plus /etc/bridge/tls). The node user can read /var/run/vsm/ca/ca.crt and /usr/share/.env, and all mounts are removed cleanly on shutdown.
  • Not yet run on a real Ubuntu 26.04 runner. Re-running vercel/api#114289 against a bridge release with this change will confirm it.

Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>

Ubuntu 25.04+ hosts (including GitHub ubuntu-latest, now 26.04) apply an AppArmor profile to fusermount3 by path, even in containers started with apparmor=unconfined, so every bridge file-sharing mount failed with 'fusermount3: mount failed: Permission denied'. The interceptor runs as root with CAP_SYS_ADMIN, so call mount(2) directly via go-fuse DirectMount and keep fusermount as the fallback.

Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>

This branch has not been deployed

No deployments
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