What I found funny when I discovered it is that you can create a thread in the same process that provides the FUSE file system implementation for this very process. It makes it much easier to write certain tests, especially debugging. We had to teach valgrind that more system calls effectively perform callbacks into the same process, but fortunately valgrind already had a FUSE_COMPATIBLE_MAY_BLOCK mechanism for that.
Exploring building a tiny FUSE filesystem
11–18 of 18 posts
Re: Exploring building a tiny FUSE filesystem
#12The glibc test suite contains a few tiny FUSE file systems. For example, there is one that just happens to contain every file that mkstemp attempts to create, for a test that exercises the O_CREAT|O_EXCL failure path. Like the Rust fuser crate, it uses the kernel API directly. The tests are slightly brittle because sometimes we encounter a new LSM that triggers unexpected file system operations, but it's not too bad…
It used to be you had to wade through massive logs though, if you don't get things quite tweaked - but in the AI/ML agent sense of things these days, just describe what you need, FUSE the right nodes, and run the bpf scripts, yo ..
Re: Exploring building a tiny FUSE filesystem
#13I don't know why, but I really enjoy reading this kind of content. I admire the people who implement and maintain this system.
FUSE is immensely useful, also. Its the front-/back- door to a lot of things. There's only a few steps left to a tiny crypto-stack, hosted on top of it ..
Re: Exploring building a tiny FUSE filesystem
#14Can someone tell me if this is LLM generated content or not? I tried to look for obvious signs but didn't notice anything.
Re: Exploring building a tiny FUSE filesystem
#15I don't know why, but I really enjoy reading this kind of content. I admire the people who implement and maintain this system.
I agree with you, I also enjoy reading it, and admire the method as well as the result in this case. FUSE is immensely useful, also. Its the front-/back- door to a lot of things. There's only a few steps left to a tiny crypto-stack, hosted on top of it ..
Re: Exploring building a tiny FUSE filesystem
#16The glibc test suite contains a few tiny FUSE file systems. For example, there is one that just happens to contain every file that mkstemp attempts to create, for a test that exercises the O_CREAT|O_EXCL failure path. Like the Rust fuser crate, it uses the kernel API directly. The tests are slightly brittle because sometimes we encounter a new LSM that triggers unexpected file system operations, but it's not too bad…
Re: Exploring building a tiny FUSE filesystem
#17The glibc test suite contains a few tiny FUSE file systems. For example, there is one that just happens to contain every file that mkstemp attempts to create, for a test that exercises the O_CREAT|O_EXCL failure path. Like the Rust fuser crate, it uses the kernel API directly. The tests are slightly brittle because sometimes we encounter a new LSM that triggers unexpected file system operations, but it's not too bad…
Re: Exploring building a tiny FUSE filesystem
#18The glibc test suite contains a few tiny FUSE file systems. For example, there is one that just happens to contain every file that mkstemp attempts to create, for a test that exercises the O_CREAT|O_EXCL failure path. Like the Rust fuser crate, it uses the kernel API directly. The tests are slightly brittle because sometimes we encounter a new LSM that triggers unexpected file system operations, but it's not too bad…
Is that something that should be merged to upstream Valgrind?
commit 0690dc39644d15fc89813419ffcdf9754b098260
Author: Mark Wielaard
Date: Sun Sep 22 23:24:34 2024 +0200
Implement /proc/self/exe readlink[at] fallback in POST handler
Calling the readlink[at] syscall directly from the PRE handler defeats
the FUSE_COMPATIBLE_MAY_BLOCK (SfMayBlock) flag. Add a POST handler
that only explicitly calls the readlink[at] handler for the
/proc/self/exe fallback (this should be fine unless /proc is also
implemented as fuse in this process).
Adjust readlink[at] GENX_ and LINX_ syswrap macros to GENXY and LINXY.
https://bugs.kde.org/show_bug.cgi?id=493507
commit ddf397c024c80382f7a2f3a0d46d58fb839eef96
Author: Mark Wielaard
Date: Sat Sep 21 22:27:24 2024 +0200
Add missing FUSE_COMPATIBLE_MAY_BLOCKs
Various syscalls (in particular "at" variants) PRE handlers were
missing a FUSE_COMPATIBLE_MAY_BLOCK statement.
Add it to the generic PRE handlers of access and statfs64. And the
linux PRE handlers of mknodat, fchownat, futimesat, utimensat,
utimensat_time64, renameat, renameat2, readlinkat, fchmodat,
fchmodat2, faccessat and faccessat2.
https://bugs.kde.org/show_bug.cgi?id=493454