Repository navigation
core/vfs: carry the caller's supplementary groups in Context - #264
Merged
jiangliu merged 1 commit intoOct 10, 2026
Merged
Conversation
The FUSE device reports only the caller's uid, its primary gid and -- for create-family requests -- the single group of the FUSE_EXT_GROUPS extension, so a server running a passthrough file system behind a local /dev/fuse mount can resolve the caller's full supplementary group list from /proc/<pid>/status. That escape hatch does not exist for remote transports such as virtiofs: the pid is a guest pid with no meaning on the host, and permission checks that should honor supplementary groups silently degrade to uid/gid only. Give Context an optional supplementary group list that a transport or embedding VMM can inject with the request, to be used directly instead of a /proc lookup. The field is purely additive plumbing in this change: the ordinary request path leaves it None, and passthrough consumption (thread cred switching) is a separate follow-up. Carrying a Vec means Context can no longer be Copy, so the five VFS create-family entry points and the passthrough async_relay macro now clone the context instead of dereferencing it, and the struct-literal tests gain ..Default::default(). With a VFS id mapping configured, remap_ctx_ids() now translates the list to internal (host) ids together with uid/gid, using the same policy as the existing supp_gid translation: groups inside the mapped range are translated, groups outside it have no legitimate host counterpart and are dropped, so a guest can never make the daemon adopt an arbitrary host group. The arithmetic mirrors remap_id() so reverse-direction mappings don't underflow. Ported from PR cloud-hypervisor#220 ("Add supplementary groups support and POSIX permission fixes"). Co-authored-by: EJ Campbell <ejc3@users.noreply.github.com> Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
jiangliu
requested review from
bergwolf,
eryugey,
imeoer and
liubogithub
as code owners
October 10, 2026 04:57
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.
The FUSE device reports only the caller's uid, its primary gid and -- for create-family requests -- the single group of the FUSE_EXT_GROUPS extension, so a server running a passthrough file system behind a local /dev/fuse mount can resolve the caller's full supplementary group list from /proc//status. That escape hatch does not exist for remote transports such as virtiofs: the pid is a guest pid with no meaning on the host, and permission checks that should honor supplementary groups silently degrade to uid/gid only.
Give Context an optional supplementary group list that a transport or embedding VMM can inject with the request, to be used directly instead of a /proc lookup. The field is purely additive plumbing in this change: the ordinary request path leaves it None, and passthrough consumption (thread cred switching) is a separate follow-up.
Carrying a Vec means Context can no longer be Copy, so the five VFS create-family entry points and the passthrough async_relay macro now clone the context instead of dereferencing it, and the struct-literal tests gain ..Default::default().
With a VFS id mapping configured, remap_ctx_ids() now translates the list to internal (host) ids together with uid/gid, using the same policy as the existing supp_gid translation: groups inside the mapped range are translated, groups outside it have no legitimate host counterpart and are dropped, so a guest can never make the daemon adopt an arbitrary host group. The arithmetic mirrors remap_id() so reverse-direction mappings don't underflow.
Ported from PR #220 ("Add supplementary groups support and POSIX permission fixes").