Skip to content

Linux/FUSE: tune FUSE 3 init config and fix error mapping#1675

Open
abhinavagarwal07 wants to merge 2 commits intoveracrypt:masterfrom
abhinavagarwal07:fuse3-config-improvements
Open

Linux/FUSE: tune FUSE 3 init config and fix error mapping#1675
abhinavagarwal07 wants to merge 2 commits intoveracrypt:masterfrom
abhinavagarwal07:fuse3-config-improvements

Conversation

@abhinavagarwal07
Copy link
Copy Markdown

@abhinavagarwal07 abhinavagarwal07 commented Apr 15, 2026

Two small fixes for the FUSE layer, building on cdc00dc.

  1. Configure FUSE 3 caching in init

VeraCrypt exposes a fixed three-entry filesystem (/, /volume, /control) that never changes during a mount. With the default 1s entry_timeout, the kernel revalidates every dentry once per second — unnecessary round-trips to userspace that add up since the loop device and upper filesystem trigger frequent lookups.

  1. Return EIO instead of EINTR for unhandled exceptions

ExceptionToErrorCode() was returning EINTR for unknown exceptions. EINTR means "interrupted by signal, retry".

Set use_ino so the kernel honors the inode numbers already assigned
by getattr/readdir instead of synthesizing its own.

Set entry_timeout and negative_timeout to 86400 s because VeraCrypt
exposes a fixed three-entry filesystem whose layout never changes for
the lifetime of a mount.  Keep attr_timeout conservative (1 s) since
the control-file size may change once during initial setup.

These settings eliminate redundant kernel-to-userspace round-trips on
every stat/lookup without affecting correctness.
EINTR tells the kernel the operation was interrupted by a signal and
should be retried, which causes callers to loop indefinitely on
persistent errors.  EIO correctly signals an unrecoverable I/O error.
@idrassi
Copy link
Copy Markdown
Member

idrassi commented Apr 16, 2026

Thank you for the PR.

I reviewed the change and I don't think this can be merged as-is.

The use_ino = 1 change looks reasonable: VeraCrypt now provides stable inode numbers for the fixed auxiliary FUSE entries and this makes FUSE3 honor them for stat/readdir.

The ExceptionToErrorCode change from -EINTR to -EIO for otherwise-unhandled exceptions also looks correct.

The problematic part is:

cfg->entry_timeout = 86400.0;

VeraCrypt auxiliary FUSE mount uses allow_other on Linux and relies on per-request fuse_get_context()->uid checks in userspace.
libfuse documents a known security issue with allow_other when default_permissions is not used: permission-check results for a directory entry may be reused while the inode remains cached, including for later accesses by another user. Increasing positive entry caching to 24 hours expands that risk. See https://github.com/libfuse/libfuse/blob/master/README.md#security-implications and https://libfuse.github.io/doxygen/structfuse__config.html .

For this reason, please remove the long entry_timeout change or rework the mount to use default_permissions and provide evidence that the existing mode bits and access model remain correct for VeraCrypt auxiliary mount. I would also avoid changing permission-sensitive lookup caching unless we have a runtime test covering cross-user access behavior with allow_other.

There is also a smaller issue: the commit/PR description still says negative_timeout is set to 86400 seconds, but the final code no longer sets negative_timeout. Please update the description/commit message so it matches the submitted code.

cfg->gid = FuseService::GetGroupId();

cfg->use_ino = 1;
cfg->entry_timeout = 86400.0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VeraCrypt auxiliary FUSE mount uses allow_other on Linux and relies on userspace fuse_get_context()->uid checks for access control. libfuse documents a known security issue with allow_other when default_permissions is not used: permission-check results for cached directory entries may be reused for later accesses, including accesses by another user, while the inode remains in kernel cache.

Setting entry_timeout to 24 hours expands that risk for a security-sensitive mount. Please either remove this entry_timeout change or rework the mount to use default_permissions and provide validation that cross-user access behavior remains correct.

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.

2 participants