Live data from Hacker News

Userspace FUSE for macOS

fuse-t.org

111–120 of 137 posts

Re: Userspace FUSE for macOS

#111

Earlier quoted context omitted.

The developer says they will release source code soon – https://github.com/macos-fuse-t/fuse-t/issues/1#issuecomment... – although keeping the restrictive license. Apple is introducing user-space file system technology in macOS – LiveFS/UserFS/com.apple.filesystems.lifs – some of the infrastructure turned up in Monterey, in Ventura it is actually being used for mounting FAT/exFAT filesystems. It looks like for now Ap…

They have the right to use whatever licensing they want, but it is strange that this one area - FUSE on Mac - consistently attracts developers using weird license restrictions.

Because the Apple developer culture just like on the Windows side has always been welcoming to commercial software, that is how one keeps a paycheck doing desktop utilities.

Re: Userspace FUSE for macOS

#112
post #98

Earlier quoted context omitted.

Unix sockets should definitely not be in any non-tmpfs filesystem, subdirectories of /run are the sole place they should be.

Care to justify your advice?

They are ephemeral, they hold no data after being closed and backups of them aren't useful. Only the name is needed, therefore a tmpfs is the place to store them.

Re: Userspace FUSE for macOS

#113

What a coincidence! For a project that I maintain (Buildbarn, a distributed build cluster for Bazel) I recently generalized all of the FUSE code I had into a generic VFS that can both be exposed over FUSE and NFSv4. The intent was the same: to provide a better out of the box experience on macOS. Here's a design doc I wrote on that change. Slight warning that it's written with some Buildbarn knowledge in mind. https:/…

Replying to my own comment: I do wonder how this library deals with some of the fundamental differences beween FUSE and NFSv4. For example, with FUSE the kernel and server share intimate knowledge on which part of the file system lives in the kernel's inode cache. Only when the kernel issues a FORGET call, may the server drop information corresponding to a given nodeid. As NFSv4 is designed to be stateless, servers m…

The DB for the necessary state could also be on-disk. Maybe in practice you can expire things after a reasonably long time, like a week, even though that's not strictly spec conforming.

Re: Userspace FUSE for macOS

#114
post #112

Earlier quoted context omitted.

Care to justify your advice?

They are ephemeral, they hold no data after being closed and backups of them aren't useful. Only the name is needed, therefore a tmpfs is the place to store them.

And if I want to run a daemon as a user where should the socket go?

Re: Userspace FUSE for macOS

#115

Earlier quoted context omitted.

Linux has an extension that allows an arbitrary string that is not tied to the filesystem. This makes it easier to stay within the limit or you can crypto hash an arbitrarily long string down to 108 chars.

This can be pretty dangerous because it is basically the same as using a TCP socket on localhost (assuming you are speaking of abstract sockets).

Yeah, abstract sockets, good points about security.

Re: Userspace FUSE for macOS

#116

Earlier quoted context omitted.

Linux has an extension that allows an arbitrary string that is not tied to the filesystem. This makes it easier to stay within the limit or you can crypto hash an arbitrarily long string down to 108 chars.

This can be pretty dangerous because it is basically the same as using a TCP socket on localhost (assuming you are speaking of abstract sockets).

Even though you lose the filesystem-based security, you can still use SO_PEERCRED or getpeereid and validate the caller's UID is what you expect, something which Linux doesn't support on localhost TCP sockets. Requiring the client's UID (and maybe GID too) to be the same as your own is a sane default for services intended for per-user usage.

Re: Userspace FUSE for macOS

#117
post #97

Earlier quoted context omitted.

I think the answer on Windows is "No". One could fork a subprocess, chdir()+socket() there, then pass the socket back to parent over another socket (opened maybe with socketpair().) Should work on any Unix-like which supports SCM_RIGHTS (which is almost everybody, apparently even obscure platforms like AIX, IBM i, z/OS). But not Windows, which doesn't (at least not yet, they may add it at some point.) Makes one reall…

In Windows we actually have a way to set the parent directory for a UDS bind or connect, via a socket ioctl. It’s not documented yet, but it’s in the header.

Cool, did not know that. Indeed I see this in shared/afunix.h:

    #define SIO_AF_UNIX_GETPEERPID _WSAIOR(IOC_VENDOR, 256) // Returns ULONG PID of the connected peer process
    #define SIO_AF_UNIX_SETBINDPARENTPATH _WSAIOW(IOC_VENDOR, 257) // Set the parent path for bind calls
    #define SIO_AF_UNIX_SETCONNPARENTPATH _WSAIOW(IOC_VENDOR, 258) // Set the parent path for connect calls
    // NOTE: setting the parent path is not thread safe.
SIO_AF_UNIX_GETPEERPID is something I did not know about either, although apparently a bit buggy – https://github.com/microsoft/WSL/issues/4676

What does the "NOTE: setting the parent path is not thread safe" comment mean? Not thread safe if multiple threads are sharing the same socket? (Which seems like an acceptable limitation.) Or something worse than that?

Re: Userspace FUSE for macOS

#118

Earlier quoted context omitted.

The developer says they will release source code soon – https://github.com/macos-fuse-t/fuse-t/issues/1#issuecomment... – although keeping the restrictive license. Apple is introducing user-space file system technology in macOS – LiveFS/UserFS/com.apple.filesystems.lifs – some of the infrastructure turned up in Monterey, in Ventura it is actually being used for mounting FAT/exFAT filesystems. It looks like for now Ap…

They have the right to use whatever licensing they want, but it is strange that this one area - FUSE on Mac - consistently attracts developers using weird license restrictions.

This is because Google et. al. will take the code and use it unless you do this. (In which case they’ll reimplement it and not pay you, but at least you tried I guess…)

Re: Userspace FUSE for macOS

#119
post #34

macOS Ventura has moved some lesser-used file systems (FAT, exFAT) out of the kernel to user-space, I believe using a private framework developed for iOS (when that added USB mass-storage support). Hopefully they’ll open those APIs up for 3rd party usage on the Mac next year.

My impression was that there were no plans to do this.

Re: Userspace FUSE for macOS

#120

Earlier quoted context omitted.

You should send feedback

Maybe? Maybe they also shouldn't ship garbage that doesn't work and expect others to debug it? Maybe this should also happen before you deprecate and make it essentially impossible to install kext's? (It's possible, but trying to walk users through it is a great way to lose 99% of your user base instantly) (My experience with driverkit is identical to the parent's) The whole "we removed it for security reasons" is al…

That’s because applications have a bunch of easy logic bugs to exploit rather than weird memory corruption you have to wrangle with in a driver, not because the drivers are any more secure.
Post reply on HN