Skip to content

Ignore mount options libfuse 3 removed, and guard against null paths - #576

Merged
smessmer merged 4 commits into
feature/fuse3from
fix/fuse3-option-and-nullpath-guards
Sep 6, 2026
Merged

smessmer merged 4 commits into
feature/fuse3from
fix/fuse3-option-and-nullpath-guards

Conversation

@smessmer

@smessmer smessmer commented Sep 5, 2026

Copy link
Copy Markdown
Member

Part of the review of the libfuse 3 migration. Two small findings at the same boundary, the mount options we hand libfuse and the arguments libfuse hands us.

Mount options libfuse 3 removed

libfuse 3 dropped a set of mount options libfuse 2 accepted, and an option it does not know makes it refuse the mount. The migration correctly dropped the hard-coded -o big_writes, but cryfs -o forwards whatever the user passes, so the libfuse 2 spellings now abort the mount with a message from libfuse and nothing from us.

They are removed with a warning instead:

$ cryfs base mnt -o hard_remove,big_writes,allow_other
[cryfs] [warning] Ignoring mount option 'hard_remove'. It doesn't exist anymore in libfuse 3:
  libfuse 3 decides this itself and hides unlinked but still open files.
[cryfs] [warning] Ignoring mount option 'big_writes'. It doesn't exist anymore in libfuse 3:
  libfuse 3 always allows large writes.

The filesystem then mounts, with allow_other still applied, confirmed in /proc/mounts. Before this, the same command printed fuse: unknown option(s) and mounted nothing.

The list is not guesswork. Every option was run against a real CryFS on both libfuse 3.14.0 and 3.17.2:

Option libfuse 3.14.0 libfuse 3.17.2
hard_remove, use_ino, readdir_ino, direct_io refused refused
nopath, intr, intr_signal=, big_writes refused refused
large_read, max_write= refused refused
kernel_cache, auto_cache, noauto_cache mounted mounted
umask=, uid=, gid= mounted mounted
entry_timeout=, negative_timeout=, attr_timeout=, ac_attr_timeout= mounted mounted
allow_other, default_permissions, noatime mounted mounted

The options that still work are left alone. max_read= is deliberately not in the list: it fails on both versions but not with an unknown-option error, and I did not pin down why.

The man page lists what is ignored.

A latent bug in the option walk

The walk over the -o values moves into fspp/fuse/MountOptions so the atime extraction and this new filter share it. That also fixes something in the old walk: after erasing the -o and its value it kept using a reference into the vector it had just erased from, which is undefined behaviour. It happened to work because the freed slot never compared equal to "-o". The shared version indexes instead of holding a reference.

Null paths

The operations that take a fuse_file_info can be called with a null path, when the node has left its tree and the filesystem told libfuse it can work from the handle alone (get_path_nullok in libfuse's lib/fuse.c). CryFS never asks for that, so it is unreachable today, but constructing a boost::filesystem::path from a null pointer is undefined behaviour. The fifteen wrappers that receive a fuse_file_info now refuse the request with EIO instead of walking into it.

The same shape existed in the FUSE 2 wrappers. What is new is that chmod, chown, truncate and utimens now take a fuse_file_info too, which widens the surface.

This one has no test. CryFS cannot reach the case, which is exactly why it was only a latent problem, and forcing it would mean enabling nullpath_ok, which is the thing we do not want.

Tests

MountOptionsTest covers the walk (comma-separated lists, several -o arguments, arguments that are not mount options, and dropping a -o that ends up without a value, which libfuse also rejects) and the filter, with the removed and the kept options exactly as the two libfuse versions answered them, plus guards so that big_writes_but_not_really, intrepid and a bare max_write are not touched.

Suite Result
fspp-test 1021 passed
cryfs-cli-test 226 passed

The cryfs-cli-test run excludes the permission tests, which cannot pass as root. CI runs them unprivileged.

🤖 Generated with Claude Code

https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP


Generated by Claude Code

Two things at the boundary to libfuse.

First: libfuse 3 dropped a set of mount options libfuse 2 accepted, and an
option it doesn't know makes it refuse the mount. 'cryfs -o' forwards
whatever the user passes, so the libfuse 2 spellings now abort the mount
with a message from libfuse and nothing from us. The ones that are gone are
removed with a warning instead:

    $ cryfs base mnt -o hard_remove,big_writes,allow_other
    [cryfs] [warning] Ignoring mount option 'hard_remove'. It doesn't exist
      anymore in libfuse 3: libfuse 3 decides this itself and hides unlinked
      but still open files.
    [cryfs] [warning] Ignoring mount option 'big_writes'. It doesn't exist
      anymore in libfuse 3: libfuse 3 always allows large writes.
    # mounted, with allow_other still applied

Each of hard_remove, use_ino, readdir_ino, direct_io, nopath, intr,
intr_signal, big_writes, large_read and max_write was verified against
libfuse 3.14.0 and 3.17.2 to make libfuse print "unknown option(s)" and
refuse the mount. Options libfuse 3 still knows, including kernel_cache,
auto_cache, umask, uid, gid and the timeout options, are left alone; that
was checked the same way. The man page lists the removed ones.

The walk over the '-o' values moves into fspp/fuse/MountOptions, and the
atime extraction now shares it. That also fixes a latent bug in the old
walk: after erasing the '-o' and its value it kept using a reference into
the vector it had just erased from, which is undefined behaviour. It
happened to work because the freed slot never compared equal to "-o".

Second: the operations that take a fuse_file_info can be called with a null
path, when the node has left its tree and the file system told libfuse it
can work from the handle alone. CryFS never asks for that, but constructing
a boost::filesystem::path from a null pointer is undefined behaviour, so the
wrappers now refuse the request with EIO instead. The same shape existed in
the FUSE 2 wrappers; the new fi-taking chmod, chown and utimens widen it.

Tests: MountOptionsTest covers the walk (comma separated lists, several '-o'
arguments, arguments that aren't mount options, and dropping a '-o' that
ends up without a value, which libfuse also rejects) and the filter, with
the removed and the kept options listed as the versions above answered them,
plus guards for similarly named options.

The null path guard has no test: CryFS cannot reach the case, which is
exactly why it was only a latent problem.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP

smessmer commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

The failing CI (windows-2022, Debug / Release / RelWithDebInfo) jobs are not this PR's.

They fail at build on feature/fuse3 itself: the migration made the sources FUSE 3 only while CMake still linked Dokany's FUSE 2 wrapper on Windows. The branch's own CI run 1647 shows all three Windows jobs and all 15 macOS jobs failing at Build the same way, before this branch existed.

The fix is open as #578 for Windows and #577 for macOS. I have not ported either into this PR: both rewrite src/fspp/fuse/params.h, so copies across the open pull requests would conflict with each other and with the originals, and the platform change should land once rather than six times.

The Linux jobs are the ones that exercise this change, and they pass. I have not re-run the Windows jobs, because they fail with a deterministic compile error rather than intermittently.


Generated by Claude Code

The gcc 14 CI jobs fail to build this file:

    MountOptionsTest.cpp:16:35: error: no matching function for call to
      'find(vector<string>::const_iterator, vector<string>::const_iterator,
            const string&)'
      return keep.end() != std::find(keep.begin(), keep.end(), option);

The test helper calls std::find but only includes <gtest/gtest.h> and
MountOptions.h. With libstdc++ 14 the only std::find in scope is the
istreambuf_iterator overload that <bits/streambuf_iterator.h> pulls in through
gtest, so the call doesn't resolve, the lambda's return type can't be deduced,
and it no longer converts to the std::function the walker takes. libstdc++ 13
happens to make <algorithm> visible transitively, which is why this built
locally and on the clang libc++ jobs.

Include <algorithm> explicitly, plus <string> and <vector> for the two types the
file names directly.

Reproduced with g++-14 before the change and verified after: the file compiles
clean, a full g++-14 Release build of fspp-test, cryfs-test and cryfs-cli-test
succeeds with no errors, fspp-test passes all 1033 tests and the 14 mount option
tests pass.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP
@smessmer
smessmer force-pushed the fix/fuse3-option-and-nullpath-guards branch from 6022c9e to 073f4e6 Compare September 6, 2026 01:45
@smessmer
smessmer merged commit 45abe89 into feature/fuse3 Sep 6, 2026
157 of 260 checks passed
@smessmer
smessmer deleted the fix/fuse3-option-and-nullpath-guards branch September 6, 2026 19:25
smessmer pushed a commit that referenced this pull request Sep 6, 2026
…s-fuse2-path

#576 added the is_null_path() helper at the top of the anonymous namespace in
Fuse.cpp, which is exactly where this branch opens its
#if FUSE_MAJOR_VERSION >= 3 for the getattr/fgetattr split, so the two collided.

Resolved by nesting rather than choosing: is_null_path() stays before the guard.
It has to, because seven of its fifteen call sites (open, read, write, flush,
release, fsync, readdir and friends) are in operations that are compiled on both
the FUSE 2 and the FUSE 3 path, so defining it inside the guard would not compile
on Windows.

The FUSE 2 branches deliberately do not get the null-path guard. libfuse only
passes a null path when the file system sets nullpath_ok, and Dokany's wrapper -
FUSE_MAJOR_VERSION 2, FUSE_MINOR_VERSION 7 - has no such member: grepping its
headers for nullpath_ok and flag_nullpath_ok finds nothing, while upstream
libfuse 2.9.9 has flag_nullpath_ok and 3.9.0 has nullpath_ok. There is no way for
a null path to arrive on the Dokany path, so guarding there would add dead code.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP
smessmer added a commit that referenced this pull request Sep 7, 2026
…576)

* Ignore mount options libfuse 3 removed, and guard against null paths

Two things at the boundary to libfuse.

First: libfuse 3 dropped a set of mount options libfuse 2 accepted, and an
option it doesn't know makes it refuse the mount. 'cryfs -o' forwards
whatever the user passes, so the libfuse 2 spellings now abort the mount
with a message from libfuse and nothing from us. The ones that are gone are
removed with a warning instead:

    $ cryfs base mnt -o hard_remove,big_writes,allow_other
    [cryfs] [warning] Ignoring mount option 'hard_remove'. It doesn't exist
      anymore in libfuse 3: libfuse 3 decides this itself and hides unlinked
      but still open files.
    [cryfs] [warning] Ignoring mount option 'big_writes'. It doesn't exist
      anymore in libfuse 3: libfuse 3 always allows large writes.
    # mounted, with allow_other still applied

Each of hard_remove, use_ino, readdir_ino, direct_io, nopath, intr,
intr_signal, big_writes, large_read and max_write was verified against
libfuse 3.14.0 and 3.17.2 to make libfuse print "unknown option(s)" and
refuse the mount. Options libfuse 3 still knows, including kernel_cache,
auto_cache, umask, uid, gid and the timeout options, are left alone; that
was checked the same way. The man page lists the removed ones.

The walk over the '-o' values moves into fspp/fuse/MountOptions, and the
atime extraction now shares it. That also fixes a latent bug in the old
walk: after erasing the '-o' and its value it kept using a reference into
the vector it had just erased from, which is undefined behaviour. It
happened to work because the freed slot never compared equal to "-o".

Second: the operations that take a fuse_file_info can be called with a null
path, when the node has left its tree and the file system told libfuse it
can work from the handle alone. CryFS never asks for that, but constructing
a boost::filesystem::path from a null pointer is undefined behaviour, so the
wrappers now refuse the request with EIO instead. The same shape existed in
the FUSE 2 wrappers; the new fi-taking chmod, chown and utimens widen it.

Tests: MountOptionsTest covers the walk (comma separated lists, several '-o'
arguments, arguments that aren't mount options, and dropping a '-o' that
ends up without a value, which libfuse also rejects) and the filter, with
the removed and the kept options listed as the versions above answered them,
plus guards for similarly named options.

The null path guard has no test: CryFS cannot reach the case, which is
exactly why it was only a latent problem.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP

* Include <algorithm> in MountOptionsTest

The gcc 14 CI jobs fail to build this file:

    MountOptionsTest.cpp:16:35: error: no matching function for call to
      'find(vector<string>::const_iterator, vector<string>::const_iterator,
            const string&)'
      return keep.end() != std::find(keep.begin(), keep.end(), option);

The test helper calls std::find but only includes <gtest/gtest.h> and
MountOptions.h. With libstdc++ 14 the only std::find in scope is the
istreambuf_iterator overload that <bits/streambuf_iterator.h> pulls in through
gtest, so the call doesn't resolve, the lambda's return type can't be deduced,
and it no longer converts to the std::function the walker takes. libstdc++ 13
happens to make <algorithm> visible transitively, which is why this built
locally and on the clang libc++ jobs.

Include <algorithm> explicitly, plus <string> and <vector> for the two types the
file names directly.

Reproduced with g++-14 before the change and verified after: the file compiles
clean, a full g++-14 Release build of fspp-test, cryfs-test and cryfs-cli-test
succeeds with no errors, fspp-test passes all 1033 tests and the 14 mount option
tests pass.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP

---------

Co-authored-by: Claude <[email protected]>
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