Re: [PATCH 0/7] fix up issues from djwong/fuse4fs-fork

Theodore Tso
2026-05-06T09:29:21Z

On Tue, May 05, 2026 at 03:56:35PM -0700, Darrick J. Wong wrote:
> FUSE kABI 7.20 added FUSE_AUTO_INVAL_DATA, which is bit 12. It looks to
> me as though they decided to add their own MacOS-specific feature flags
> at the end of the u32 want field. Then Linux FUSE added 11 more feature
> flags, at which point they unthinkingly ported over FUSE_CACHE_SYMLINKS,
> which collides with FUSE_DARWIN_ACCESS_EXT. Apparently nobody on the
> macfuse end noticed, so on your machine you're getting whatever
> "ACCESS_EXT" does.

Yeah....

What MacFuse needs to do is to steal some extra fields from struct
fuse_init_in and fuse_init_out for the darwin-specific capabilities.
It turns out it already has conn->{want,capable}_darwin, but there's
no way to pass it in and out of op_init....

#ifdef __APPLE__
/*
* TODO(bf)
*
* Resolve conflict with vanilla API. We need a separate field flags for
* Darwin-only flags. As long as we don't support anything beyond ABI
* version 7.19 on the kernel-side this should not be an issue, though.
* We need to clean this up when moving to 7.20 or later.
*/
if (se->conn.want_darwin & FUSE_DARWIN_CAP_ACCESS_EXT)
outargflags |= FUSE_DARWIN_ACCESS_EXT;

So I *guess* what MacFuse needs to do is to do something like:

struct fuse_init_in {
uint32_t major;
uint32_t minor;
uint32_t max_readahead;
uint32_t flags;
uint32_t flags2;
uint32_t unused[9];
uint32_t darwin_flags;
uint32_t darwin_flags2;
};

am I right in understanding that fuse_*_{in,out} is private between
the OS's libfuse and OS's fuse driver or kernel extension, so
it's not disastrous for fuse_kernel.h for Mac and Linux to drift?

> Does this work?
>
> /* MacFUSE overlays feature bits with LinuxFUSE, this is fcked up */
> #if defined(FUSE_CAP_CACHE_SYMLINKS) && !defined(FUSE_CACHE_SYMLINKS)
> fuse_set_feature_flag(conn, FUSE_CAP_CACHE_SYMLINKS);
> #endif

What I'm thinking about doing is adding at the beginning of
fuse[24]fs.c:

#ifdef __APPLE__
/*
* Sigh.... MacFuse is overloading the top bits of the flags field of
* struct fuse_init_{out} so we have to avoid using these capability
* flags until this gets fixed in MacFUSE
*/
#undef FUSE_CACHE_SYMLINKS
#undef FUSE_NO_OPENDIR_SUPPORT
#undef FUSE_EXPLICIT_INVAL_DATA
#undef FUSE_MAP_ALIGNMENT
#undef FUSE_SUBMOUNTS
#undef FUSE_HANDLE_KILLPRIV_V2
#undef FUSE_SETXATTR_EXT
#undef FUSE_INIT_EXT
#endif

- Ted