qemu-gpiodev/libfuse.git
11 months agoBump actions/checkout from 4.1.2 to 4.1.3 (#934)
dependabot[bot] [Fri, 26 Apr 2024 12:19:16 +0000 (14:19 +0200)]
Bump actions/checkout from 4.1.2 to 4.1.3 (#934)

Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.2 to 4.1.3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/9bb56186c3b09b4f86b1c65136769dd318469633...1d96c772d19495a3b5c517cd2bc0cb401ea0529f)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
11 months ago[libFuse 3.16.2]Compilation failure on freeBSD #936 (#938)
Bernd Schubert [Thu, 25 Apr 2024 15:09:05 +0000 (17:09 +0200)]
[libFuse 3.16.2]Compilation failure on freeBSD #936 (#938)

Despite the creation of the header file fuse_config.h during LibFUSE
version 3.16.2's Meson build process, the BSD mount_bsd.c file continues to reference config.h. Consequently, this discrepancy results in compilation failures.

FIX : Point the mount_bsd.c to correct header.

11 months ago Use single place to define the version and increase version to 3.17.0 (#932)
Bernd Schubert [Mon, 22 Apr 2024 10:05:39 +0000 (12:05 +0200)]
 Use single place to define the version and increase version to 3.17.0 (#932)

* Use single place to define the version

Defining the version in fuse_common.h, is removed, it is defined
through meson and provided by "libfuse_config.h". I.e. it avoids
to define the version twice - once in meson and once in
fuse_common.h.

Ideal would be to set integers in the meson file and create the version
string from these integers. However, meson requires that "project"
is the first meson.build keyword - with that it requires to
set the version from a string and then major/minor/hotfix integers
are created from string split.

Signed-off-by: Bernd Schubert <bernd.schubert@fastmail.fm>
* Increase the version to 3.17.0

This is to prepare the branch for the next release.

Signed-off-by: Bernd Schubert <bernd.schubert@fastmail.fm>
---------

Signed-off-by: Bernd Schubert <bernd.schubert@fastmail.fm>
11 months agoexample/: Convert all fuse_session_loop_mt users to 3.12 API (#931)
Bernd Schubert [Sat, 20 Apr 2024 20:56:13 +0000 (22:56 +0200)]
example/: Convert all fuse_session_loop_mt users to 3.12 API (#931)

Convert all the remaining users of fuse_session_loop_mt() to
the new 3.12 config api.

11 months agopassthrough_ll: fix fd leaks in lo_destroy() (#929)
legezywzh [Sat, 20 Apr 2024 11:40:16 +0000 (19:40 +0800)]
passthrough_ll: fix fd leaks in lo_destroy() (#929)

By virtio-fs and libfuse fuse_custom_io, passthrough_ll could be
a virtio filesystem device backend, this bug was found when doing
mount, fsstress and umount repeatedly.

Signed-off-by: Xiaoguang Wang <lege.wang@jaguarmicro.com>
Co-authored-by: Xiaoguang Wang <lege.wang@jaguarmicro.com>
11 months agoAdd clone_fd to custom IO (#927)
legezywzh [Thu, 18 Apr 2024 09:29:35 +0000 (17:29 +0800)]
Add clone_fd to custom IO (#927)

Define a new clone_fd() helper for fuse_custom_io, users
can implement their own clone fd logic.

Signed-off-by: Xiaoguang Wang <lege.wang@jaguarmicro.com>
11 months agofix max_write update in do_init() (#926)
legezywzh [Tue, 16 Apr 2024 15:23:57 +0000 (23:23 +0800)]
fix max_write update in do_init() (#926)

If user updates conn->max_write in fuse_lowlevel_ops' init() method, do_init()
will miss the "conn.max_write > bufsize - FUSE_BUFFER_HEADER_SIZE" judgment,
and ->init method will be called after it, which obviously is a bug.

Signed-off-by: Xiaoguang Wang <lege.wang@jaguarmicro.com>
Co-authored-by: Xiaoguang Wang <lege.wang@jaguarmicro.com>
11 months agofusermount: Fix use of uninitialized x_mnt_opts (#924)
Bernd Schubert [Sat, 6 Apr 2024 13:19:33 +0000 (15:19 +0200)]
fusermount: Fix use of uninitialized x_mnt_opts (#924)

x_mnt_opts was not initialized to 0, but strncat was done

Spotted by cppcheck running on our ddn branch.

11 months agoAdd more documentation for FUSE_CAP_EXPORT_SUPPORT (#917)
Bernd Schubert [Tue, 2 Apr 2024 21:52:18 +0000 (23:52 +0200)]
Add more documentation for FUSE_CAP_EXPORT_SUPPORT (#917)

Add more documentation for FUSE_CAP_EXPORT_SUPPORT

Also remove the flag from passthrough_ll.c and passthrough_hp.cc
as these implementations do _not_ handle that flag. They just
cast fuse_ino_t to an inode and cause a heap buffer overflow
for unknown objects (simplest reproducer are the examples
in "man 2 open_by_handle_at", but to unmount/mount the file
system after name_to_handle_at and before open_by_handle_at).

Fixes https://github.com/libfuse/libfuse/issues/838

---------

Co-authored-by: Nikolaus Rath <Nikolaus@rath.org>
12 months agoAdd support for FUSE_CAP_HANDLE_KILLPRIV_V2
Bernd Schubert [Thu, 28 Mar 2024 14:18:14 +0000 (15:18 +0100)]
Add support for FUSE_CAP_HANDLE_KILLPRIV_V2

This just adds in the basic handler, but does not
use it yet in examples.

12 months agoFix FUSE_CAP_DIRECT_IO_ALLOW_MMAP - use new numerical value
Bernd Schubert [Wed, 27 Mar 2024 19:23:12 +0000 (20:23 +0100)]
Fix FUSE_CAP_DIRECT_IO_ALLOW_MMAP - use new numerical value

Commit 22741f5  accidentally re-used (1 << 27), which is
already taken for FUSE_CAP_SETXATTR_EXT.

Fortunately not part of any release yet.

12 months agoInstall all test/build python packages from requirements.txt
Ashley Pittman [Sat, 23 Mar 2024 19:50:59 +0000 (19:50 +0000)]
Install all test/build python packages from requirements.txt

Have GitHub actions setup python on runners and install
all python dependencies via pip.

Signed-off-by: Ashley Pittman <ashley@pittman.co.uk>
12 months agofix readdirplus when filler is called with zero offset (#896)
farlongsignal [Sun, 24 Mar 2024 20:54:19 +0000 (21:54 +0100)]
fix readdirplus when filler is called with zero offset (#896)

fixes #235

In fill_dir_plus(), there's a lookup for caching dirent attributes.
However, when offset = 0 the cache metadata from the lookup is lost
as only the entry attributes are passed when added to the list. Kernel
doesn't cache the attributes since .ino = 0.

This change moves the entry lookup to happen just before the relevant
fuse_add_direntry_plus() calls

12 months agoreset got_init after handling FUSE_DESTROY message (#910)
legezywzh [Thu, 21 Mar 2024 09:02:05 +0000 (17:02 +0800)]
reset got_init after handling FUSE_DESTROY message (#910)

User may still need to mount same fuse filesystem after umounting
it(In this case, the userspace filesystem server needs to keep live),
and after handling FUSE_DESTROY message, new FUSE_INIT message may come,
so need to reset got_init to be zero.

Signed-off-by: Xiaoguang Wang <lege.wang@jaguarmicro.com>
12 months agoci-build.sh: Fix checking for function arguments (#909)
Bernd Schubert [Wed, 20 Mar 2024 15:43:54 +0000 (16:43 +0100)]
ci-build.sh: Fix checking for function arguments (#909)

Checking for an emtpy string actually doesn't work for $@,
so just check for number of arguments.

Co-authored-by: Bernd Schubert <bschubert@ddn.com>
12 months agoAdd FUSE_FILL_DIR_DEFAULTS enum (#903)
FredyVia [Wed, 20 Mar 2024 15:08:04 +0000 (23:08 +0800)]
Add FUSE_FILL_DIR_DEFAULTS enum (#903)

In order to use the fuse_fill_dir_t function in a C++ program, add the enum item:
FUSE_FILL_DIR_DEFAULTS

Without this change g++ compilation failed with
example/hello.c:94:35: error: invalid conversion from ‘int’ to ‘fuse_fill_dir_flags’ [-fpermissive]
   94 |         filler(buf, ".", NULL, 0, 0);
      |                                   ^
      |                                   |
      |                                   int

12 months agoFix example/fix-notify_inval_inode.c (#908)
Bernd Schubert [Wed, 20 Mar 2024 14:25:41 +0000 (15:25 +0100)]
Fix example/fix-notify_inval_inode.c (#908)

Similar issue as fixed in commit
3c7ba570 "examples/notify_store_retrieve: Add a clean shutdown".
Basically a clean shutdown was missing, but even with clean
shutdown it does not work, as kernel side releases inodes before
sending FUSE_DESTROY - the intervaled thread then gets
-ENOENT.

Co-authored-by: Bernd Schubert <bschubert@ddn.com>
12 months agoBump actions/checkout from 4.1.1 to 4.1.2 (#905)
dependabot[bot] [Wed, 20 Mar 2024 13:53:43 +0000 (14:53 +0100)]
Bump actions/checkout from 4.1.1 to 4.1.2 (#905)

Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.1 to 4.1.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/b4ffde65f46336ab88eb53be808477a3936bae11...9bb56186c3b09b4f86b1c65136769dd318469633)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
12 months agoMerge pull request #904 from bsbernd/s-bit-fusermount
Bernd Schubert [Wed, 20 Mar 2024 12:30:12 +0000 (13:30 +0100)]
Merge pull request #904 from bsbernd/s-bit-fusermount

Add back s-bit for compiled fusermount

12 months agoAdd final "meson setup --reconfigure" to README.md
Bernd Schubert [Wed, 20 Mar 2024 11:59:15 +0000 (12:59 +0100)]
Add final "meson setup --reconfigure" to README.md

This reconfigure is recommended to ensure the build system
(ninja/cmake/...) get the updated meson config. They
typically do, but it depends on file time stamps - is
a potential random error source.

12 months ago/test_ctests / test_notify1: Print cmdline on failure
Bernd Schubert [Wed, 20 Mar 2024 11:02:30 +0000 (12:02 +0100)]
/test_ctests / test_notify1: Print cmdline on failure

Tests sometimes fail with

pytest.fail('file system process terminated prematurely')

And it is not clear what actually happens.

12 months agoAdd glibc backtrace to signal handler
Bernd Schubert [Wed, 20 Mar 2024 10:33:46 +0000 (11:33 +0100)]
Add glibc backtrace to signal handler

It is very hard to see in github tests what is actually failing
with signals - add the gnu-libc backtrace handler.

12 months agoci-build.sh: Add back test without versioned symbols
Bernd Schubert [Tue, 19 Mar 2024 23:56:18 +0000 (00:56 +0100)]
ci-build.sh: Add back test without versioned symbols

Commit b1cdc497 ("ci-build.sh: Run ASAN and UBSAN at the same time")
also accidentally removed the test for versioned symbols.

Also export clang/clang++ to make sure new shells get it.

12 months agoBuild clang/sanitized build first
Bernd Schubert [Tue, 19 Mar 2024 23:32:40 +0000 (00:32 +0100)]
Build clang/sanitized build first

This was stalling - easier to check what happens
when it fails fast. And in general, sanitized
builds are faster than valgrind and detect almost
as much errors as valgrind (same level would be
achieved with MSAN, but that is hard to use),
so failures can be detected faster whan sanitizers
run first.

12 months agoFix use-after-free in example/poll.c
Bernd Schubert [Tue, 19 Mar 2024 23:07:44 +0000 (00:07 +0100)]
Fix use-after-free in example/poll.c

As noticed by valgrind in issue #907 example/poll.c
triggers a use-after-free

==85200== Thread 2:
==85200== Invalid read of size 4
==85200==    at 0x485E54A: send_notify_iov (fuse_lowlevel.c:2267)
==85200==    by 0x485E54A: fuse_lowlevel_notify_poll (fuse_lowlevel.c:2289)
==85200==    by 0x1096F2: fsel_producer (poll.c:245)
==85200==    by 0x4897EA6: start_thread (pthread_create.c:477)
==85200==    by 0x49ADA6E: clone (clone.S:95)
==85200==  Address 0x5291d68 is 392 bytes inside a block of size 920 free'd
==85200==    at 0x48399AB: free (vg_replace_malloc.c:538)
==85200==    by 0x485A12C: fuse_destroy (fuse.c:5103)
==85200==    by 0x486220F: fuse_main_real (helper.c:389)
==85200==    by 0x1091D6: main (poll.c:288)
==85200==  Block was alloc'd at
==85200==    at 0x483AB65: calloc (vg_replace_malloc.c:760)
==85200==    by 0x485BAA0: fuse_session_new (fuse_lowlevel.c:3036)
==85200==    by 0x4859AF2: fuse_new@@FUSE_3.1 (fuse.c:4966)
==85200==    by 0x4862129: fuse_main_real (helper.c:345)
==85200==    by 0x1091D6: main (poll.c:288)

Issue is that the "fsel_producer" thread is still active after
fuse_destroy - it gets destructed too late.

12 months agoAdd back s-bit for compiled fusermount
Bernd Schubert [Thu, 14 Mar 2024 20:27:10 +0000 (21:27 +0100)]
Add back s-bit for compiled fusermount

This is also needed by some tests and was accidentally removed
in commit aab146eea8877ee744a1b5a0da8bbbf31d14bad1

12 months agoFix test failures: Create missing mount dir
Bernd Schubert [Wed, 20 Mar 2024 00:14:07 +0000 (01:14 +0100)]
Fix test failures: Create missing mount dir

Tests were failing because mount dir was missing.
Unclear to me why this became only recently an issue
(github internal - out of the sudden tests were hanging).

12 months agoci-build.sh: Reduce pytest --maxfail from 99 to 1
Bernd Schubert [Wed, 20 Mar 2024 00:01:49 +0000 (01:01 +0100)]
ci-build.sh: Reduce pytest --maxfail from 99 to 1

We want to see errors - reduce allowed errors.
With --maxfail=99 tests out of the sudden started to hang
in github, without a change in libfuse (I had actually tested
to previous release tags). With --maxfail=1 pytest aborts
and we see failing github.

Also increase python log level to NOTSET - NOTSET should print
all messages.

Also use "pytest" has wrapper for "python3 -m"

12 months agoMerge pull request #901 from bsbernd/posix_spawn
Bernd Schubert [Thu, 7 Mar 2024 11:03:41 +0000 (12:03 +0100)]
Merge pull request #901 from bsbernd/posix_spawn

Switch from fork to posix_spawn

12 months agoci-build.sh: Always install and add s-bit for fusermount3
Bernd Schubert [Tue, 5 Mar 2024 23:37:53 +0000 (00:37 +0100)]
ci-build.sh: Always install and add s-bit for fusermount3

As per pull #898, fusermount3 had a severe issue that
should have been detected by ASAN. I guess tests used
the system default and not the sanitized binary.
Order of execution of fusermount3 is to try
1) full install path
if that fails
2) just fusermount3

So tests should be fixed by installing libfuse, setting the s-bit
on fusermount3 and then to run the tests.

12 months agoci-build.sh: Run ASAN and UBSAN at the same time
Bernd Schubert [Tue, 5 Mar 2024 23:23:22 +0000 (00:23 +0100)]
ci-build.sh: Run ASAN and UBSAN at the same time

Also set halt_on_error=1 to make UBSAN to fail if it
would find something.

12 months agoposix_spawn style updates
Bernd Schubert [Tue, 5 Mar 2024 14:47:50 +0000 (15:47 +0100)]
posix_spawn style updates

- This adds a wrapper function for the call sequence
of posix_spawn and posix_spawnp.
- Replaces perror() with fuse_log - the latter
can be redirected through the file system log function
and gives better end user friendly output
- other minor changes, like variable renames
- no functional change

12 months agoUse posix_spawn instead of fork+exec
Matthias Goergens [Tue, 5 Mar 2024 14:10:21 +0000 (15:10 +0100)]
Use posix_spawn instead of fork+exec

Client code might allocate a lot of memory before starting the mount.
Fork is slow for processes that are using a lot of memory.  But
posix_spawn fixes that.

Another issue with fork is if the process is also doing RDMA - this
might lead to data corruption, as least if memory used for RDMA
is not marked with MADV_DONTFORK.  At least with linux kernels
before 5.12.
Also see https://blog.nelhage.com/post/a-cursed-bug/ for more details

Change by Bernd:
This also prepares the new fusermount option "--comm-fd", but keeps
the previous way to pass the parameter as env variable. In a future
release (exact data to be determined) we are going to remove usage
of the env variable and will switch to the new parameter.

12 months agoFix undefined loff_t in test_write_cache.c on alpine
Bernd Schubert [Tue, 5 Mar 2024 22:39:44 +0000 (23:39 +0100)]
Fix undefined loff_t in test_write_cache.c on alpine

This fixes #899. Seems that Alpine (and maybe Fedora) need
_GNU_SOURCE to get loff_t.

12 months agofusermount: Fix head-buffer-overflow in extract_x_options
Bernd Schubert [Tue, 5 Mar 2024 17:09:33 +0000 (18:09 +0100)]
fusermount: Fix head-buffer-overflow in extract_x_options

Commit 74b1df2e introduced a heap-buffer-overflow, as
allocated memory was not initialized and extract_x_options
was also not checking for the remaining buffer size.
Fix is to initialize the buffer and to also not exceed the buffer
size. Actually not exceeding buffer size is rather complex with C
and introduced quite some code changes.

Also fixed is a memory leak of allocated buffers in the commit
mentioned above.

13 months agomeson: Point OSX (darwin) to https://www.fuse-t.org/
Bernd Schubert [Sat, 10 Feb 2024 13:46:52 +0000 (14:46 +0100)]
meson: Point OSX (darwin) to https://fuse-t.org/

www.fuse-t.org is a more recent fuse extension for OSX
based on NFS.

13 months agoexample/notify_store_retrieve: Fix races and handle errors
Bernd Schubert [Wed, 10 Jan 2024 14:11:34 +0000 (15:11 +0100)]
example/notify_store_retrieve: Fix races and handle errors

This test was racy, the lookup counter must only be increased once
kernel side has lookup completed and knows about the inode.
However, this is still racy as

app thread
(python script)  kernel-side       libfuse thread       kernel
----------------------------------------------------------------------
    open file
                 lookup req
                 wait
                                   handle req
                                   reply
                                                      wake app thread
                                                      return
                 new_inode()
                 <continue file open>

So actually on libfuse side even after returning from kernel side
it is not ensured that the kernel has created the inode. I.e.
using lookup_cnt in the test is still racy.
A new variabled 'open_cnt' is added that is only increased in open
Using open_cnt should be safe to use as kernel side (with atomic-open)
first does lookup, from that data creates the inode and only then sends
an open request. I.e. update_fs_loop() must only call
fuse_lowlevel_notify_store() once it is absolutely sure kernel side has
created the inode (open_cnt) and when it is sure the kernel inode still
exists (lookup_cnt).

Not really nice, but we actually need to accept some errors, as
these still come up at umount time. Typically it is hard to hit,
but tests in github actually frequently get it. Actually, it can be
easily reproduced by commenting out the sleep line in
update_fs_loop(). Underlying issue is that kernel side is
sending ->destroy() only when it already internally released all
inodes - too late for this test. The errors I run into are ENOENT
and EBADFD, but I added back in ENODEV for safety.

In order to avoid any other kind races mutex lock is also introduced.

13 months agoFix tests/test_write_cache in write back mode (#892)
Bernd Schubert [Mon, 26 Feb 2024 18:09:00 +0000 (19:09 +0100)]
Fix tests/test_write_cache in write back mode (#892)

This test could fail whenever a something (kernel, userspace) decides
to flush in between of two 2048B writes. These two writes are supposed
to be merged into a single 4906 byte write by the kernel writeback cache,
but _sometimes_ the test fails because 2048 byte writes get through.
Fixes #882

Solution here is a modification how the test works - instead
of requiring an exact aggregation of 2x2048B into 4096B,
it now writes 64x2048B and requires in write-back modes
the number of received writes requests is lower than 64 - we
can expect that at least some writes get aggregated, but we do
know how many.

Co-authored-by: Bernd Schubert <bschubert@ddn.com>
13 months agoMerge pull request #888 from yangyun50/master
Bernd Schubert [Mon, 26 Feb 2024 08:48:04 +0000 (09:48 +0100)]
Merge pull request #888 from yangyun50/master

passthrough examples: enable direct io when open has flag: O_DIRECT

13 months agoEnable direct IO for passthrough examples when open has flag O_DIRECT
yangyun [Fri, 23 Feb 2024 06:16:05 +0000 (14:16 +0800)]
Enable direct IO for passthrough examples when open has flag O_DIRECT

Shared locks (parallel_direct_writes) cannot be enabled for O_DIRECT, as
O_DIRECT may be set past file open time with fcntl(fd, F_SETFD, ...).
Kernel side fuse has precautions for shared lock direct-IO (direct_io in
libfuse), as it needs an exclusive inode lock when direct and page cache
IO happend at the same time.

In order to enjoy the parallel_direct_writes feature (i.e., get a shared
lock, not exclusive lock) for writes to the same file), direct_io is needed.
The feature direct_io is corresponding to FOPEN_DIRECT_IO in fuse kernel.
FOPEN_DIRECT_IO and O_DIRECT are not entirely the same as described above.
So enable direct_io (i.e., FOPEN_DIRECT_IO in fuse kernel) to enjoy parallel
direct_writes.

Some patches related to FOPEN_DIRECT_IO and O_DIRECT are below:

https://lore.kernel.org/all/753d6823-e984-4730-a126-d66b65ea772c@ddn.com

13 months agoPassthrough options starting with "x-" to mtab (#894)
Matthew [Sat, 24 Feb 2024 06:56:49 +0000 (22:56 -0800)]
Passthrough options starting with "x-" to mtab (#894)

This implements #651, tested with bindfs.

"x-*" options are comments meant to be interpreted by userspace.

#651 is about some 3rd party mount options like 'x-gvfs-notrash'.

This also removes the test if /etc/mtab is a symlink.

This test was added in commit 5f28cd15ab43c741f6d116be4d3a9aa5d82ab385
and the corresponding ChangeLog entry in this commit points to mount
issues for read-only mtab.

However, in all recent Linux distributions /etc/mtab is a symlink to
/proc/self/mounts and never writable. In fact, util-linux 2.39
(libmount) entirely removed support for a writable mtab.

At least since util-linux 2.19 (10-Feb-2011) /run/mount/utab is used
as replacement for userspace mount entries..

13 months agopassthrough_example: make parallel_direct_writes more clearly
yangyun [Fri, 23 Feb 2024 03:06:08 +0000 (11:06 +0800)]
passthrough_example: make parallel_direct_writes more clearly

Move the parallel_direct_writes enable action to the init function in high level API,
it is more recommended just like commit 8ee553dac. Besides, add some comments to show
that the feature parallel_direct_writes is depend on the feature direct_io (refer to
link: https://lwn.net/ml/linux-fsdevel/
20230918150313.3845114-1-bschubert@ddn.com for the reason).

13 months agoremove duplicated fuse_chan_put() (#893)
yangyun50 [Tue, 20 Feb 2024 10:52:39 +0000 (18:52 +0800)]
remove duplicated fuse_chan_put() (#893)

14 months agomake FUSE_CAP_EXPIRE_ONLY test depend on available cap and not on version
HereThereBeDragons [Mon, 8 Jan 2024 16:38:36 +0000 (17:38 +0100)]
make FUSE_CAP_EXPIRE_ONLY test depend on available cap and not on version

14 months agoadd support for kernel flag FUSE_HAS_EXPIRE_ONLY
HereThereBeDragons [Wed, 6 Dec 2023 14:37:38 +0000 (15:37 +0100)]
add support for kernel flag FUSE_HAS_EXPIRE_ONLY

14 months agoAdd processing for FUSE_CAP_HANDLE_KILLPRIV and disable it by default
bigbrotherwei [Wed, 17 Jan 2024 15:58:27 +0000 (23:58 +0800)]
Add processing for FUSE_CAP_HANDLE_KILLPRIV and disable it by default

'FUSE_CAP_HANDLE_KILLPRIV' is not enabled by default anymore, as that
would be a sudden security issue introduced by a new ABI and API
compatible libfuse version.

14 months agoDon't set FUSE_CAP_PARALLEL_DIROPS by default
Miklos Szeredi [Wed, 10 Jan 2024 09:15:43 +0000 (10:15 +0100)]
Don't set FUSE_CAP_PARALLEL_DIROPS by default

Allowing parallel dir operations could result in a crash in a filesystem
implementation that is not prepared for this.

To be safe keep this flag off by default (this is not a regression, since
there was no public release where this flag wasn't ignored).

If the filesystem wants better performance, then it should set this flag
explicitly.

Fixes: c9905341ea34 ("Pass FUSE_PARALLEL_DIROPS to kernel (#861)")
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
14 months agoAdd FUSE_CAP_DIRECT_IO_ALLOW_MMAP and use in passthrough_hp
Bernd Schubert [Mon, 4 Dec 2023 14:58:45 +0000 (15:58 +0100)]
Add FUSE_CAP_DIRECT_IO_ALLOW_MMAP and use in passthrough_hp

This is not called FUSE_CAP_DIRECT_IO_RELAX, as the kernel flag
FUSE_DIRECT_IO_RELAX is supposed to be renamed to
FUSE_DIRECT_IO_ALLOW_MMAP. The corresponding kernel patches just
did not land yet.

14 months agoAdd in rename to FUSE_DIRECT_IO_ALLOW_MMAP
Bernd Schubert [Tue, 5 Dec 2023 14:39:52 +0000 (15:39 +0100)]
Add in rename to FUSE_DIRECT_IO_ALLOW_MMAP

Add in the rename of FUSE_DIRECT_IO_RELAX to
FUSE_DIRECT_IO_ALLOW_MMAP.

14 months agoSynchronize fuse_kernel.h from current linux master
Bernd Schubert [Mon, 4 Dec 2023 13:53:39 +0000 (14:53 +0100)]
Synchronize fuse_kernel.h from current linux master

15 months agoexamples/notify_store_retrieve: Add a clean shutdown
Bernd Schubert [Tue, 26 Dec 2023 10:53:55 +0000 (11:53 +0100)]
examples/notify_store_retrieve: Add a clean shutdown

On shutdown update_fs_loop() was failing frequently in github
test with ENOENT, but only ENODEV was tested for and only for the.
With clean shutdown there is no need to test for such errors at all.

15 months agoAllow *xattr operations on root directory (ino 1)
amitgeron [Sun, 17 Dec 2023 17:45:47 +0000 (19:45 +0200)]
Allow *xattr operations on root directory (ino 1)

16 months agoClarify fuse_lowlevel poll() docstring (#862)
George Hilliard [Sun, 19 Nov 2023 10:27:45 +0000 (04:27 -0600)]
Clarify fuse_lowlevel poll() docstring (#862)

The original docstring was confusing; it was not clear that the ph must
be retained indefinitely, nor was it clear that the client *also* needs
to reply to the poll call immediately.

Clarify this by explaining that it is only necessary to retain a single
handle, that the client must retain ph, and that it must immediately
call reply.

16 months agoPass FUSE_PARALLEL_DIROPS to kernel (#861)
fdinoff [Thu, 16 Nov 2023 11:23:20 +0000 (06:23 -0500)]
Pass FUSE_PARALLEL_DIROPS to kernel (#861)

This tells the kernel that parallel lookup/readdir operations are
supported. This is enabled by default but was not passed to the kernel
so you always get the synchronized version.

17 months agoUpdate fuse_common.h (#855)
Caian Benedicto [Sat, 28 Oct 2023 12:45:21 +0000 (09:45 -0300)]
Update fuse_common.h (#855)

17 months agofuse_clone_chan: avoid additional FD_CLOEXEC setting if O_CLOEXEC defined (#852)
legezywzh [Wed, 25 Oct 2023 11:19:39 +0000 (19:19 +0800)]
fuse_clone_chan: avoid additional FD_CLOEXEC setting if O_CLOEXEC defined (#852)

Since open(2) has been called with O_CLOEXEC flag if defined.

Signed-off-by: Xiaoguang Wang <lege.wang@jaguarmicro.com>
Co-authored-by: Xiaoguang Wang <lege.wang@jaguarmicro.com>
17 months agoBump actions/checkout from 4.1.0 to 4.1.1 (#854)
dependabot[bot] [Wed, 25 Oct 2023 08:55:58 +0000 (09:55 +0100)]
Bump actions/checkout from 4.1.0 to 4.1.1 (#854)

Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/8ade135a41bc03ea155e62e844d188df1ea18608...b4ffde65f46336ab88eb53be808477a3936bae11)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
17 months agopassthrough_hp: Fix clone-fd option (#850)
SteveYang [Thu, 12 Oct 2023 09:18:28 +0000 (17:18 +0800)]
passthrough_hp: Fix clone-fd option (#850)

The clone-fd option is set valued but not used in the context. Use it in the code.

17 months agoEnabled parallel direct IO writes for passthrough examples
Bernd Schubert [Tue, 10 Oct 2023 11:18:36 +0000 (13:18 +0200)]
Enabled parallel direct IO writes for passthrough examples

All these passthrough examples don't need writes to be serialized.

Actually, most file systems probably handle non serialized parallel
direct writes - the FOPEN_PARALLEL_DIRECT_WRITES flag is just
to avoid a regression for those file system that rely on serialized
DIO writes in fuse kernel. Passthrough file system forward the IO
to another file system, which actually handles that internally -
serialized in fuser kernel is not needed.

17 months agoFix typo in comment
Nikolaus Rath [Tue, 10 Oct 2023 07:44:23 +0000 (08:44 +0100)]
Fix typo in comment

17 months agoReleased fuse-3.16.2 fuse-3.16.2
Nikolaus Rath [Tue, 10 Oct 2023 07:38:49 +0000 (08:38 +0100)]
Released fuse-3.16.2

17 months agoFixes typo in fuse.h (#844)
Nikola Petrov [Mon, 9 Oct 2023 20:14:39 +0000 (16:14 -0400)]
Fixes typo in fuse.h (#844)

18 months agoxfstests example: Use export in local.config and remove comment (#811)
Bernd Schubert [Tue, 26 Sep 2023 07:49:05 +0000 (09:49 +0200)]
xfstests example: Use export in local.config and remove comment (#811)

ix passthrough mount helper for running xfstests

* The mount helper does not see the env vars exported by xfstests
* Use the NFS style format TEST_DEV=source:/$TEST_SOURCE to communicate
  the sourse path to the mount helper without confusing xfstest
* Also recognise when source= is provided in mount options
* Support -o remount (e.g. for test generic/306)

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Co-authored-by: Bernd Schubert <bschubert@ddn.com>
Co-authored-by: Amir Goldstein <amir73il@gmail.com>
Co-authored-by: Nikolaus Rath <Nikolaus@rath.org>
18 months agoBump actions/checkout from 4.0.0 to 4.1.0
dependabot[bot] [Mon, 25 Sep 2023 23:00:25 +0000 (23:00 +0000)]
Bump actions/checkout from 4.0.0 to 4.1.0

Bumps [actions/checkout](https://github.com/actions/checkout) from 4.0.0 to 4.1.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/3df4ab11eba7bda6032a0b82a6bb43b11571feac...8ade135a41bc03ea155e62e844d188df1ea18608)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
18 months agopassthrough-hp: Fix --clone-fd
Bernd Schubert [Fri, 15 Sep 2023 15:21:20 +0000 (17:21 +0200)]
passthrough-hp: Fix --clone-fd

Actually one had to use --clone-fd=1 instead of
just --clone-fd.

18 months agopassthough_hp: Add a direct-io option
Bernd Schubert [Fri, 15 Sep 2023 14:43:25 +0000 (16:43 +0200)]
passthough_hp: Add a direct-io option

this is needed to test FOPEN_DIRECT_IO with xfstests. Also useful
for some benchmarks.

18 months agoBump actions/checkout from 3.6.0 to 4.0.0 (#837)
dependabot[bot] [Tue, 5 Sep 2023 07:51:37 +0000 (08:51 +0100)]
Bump actions/checkout from 3.6.0 to 4.0.0 (#837)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3.6.0 to 4.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/f43a0e5ff2bd294095638e18286ca9a3d1956744...3df4ab11eba7bda6032a0b82a6bb43b11571feac)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
18 months agoBump actions/checkout from 3.5.3 to 3.6.0 (#833)
dependabot[bot] [Sat, 2 Sep 2023 14:47:19 +0000 (15:47 +0100)]
Bump actions/checkout from 3.5.3 to 3.6.0 (#833)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.3 to 3.6.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/c85c95e3d7251135ab7dc9ce3241c5835cc595a9...f43a0e5ff2bd294095638e18286ca9a3d1956744)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
19 months agoAdd NTFS3 kernel driver fs to the whitelist of mount targets (#830)
mrdvdrm [Fri, 25 Aug 2023 17:03:54 +0000 (19:03 +0200)]
Add NTFS3 kernel driver fs to the whitelist of mount targets (#830)

With Linux Kernel 5.15 new ntfs kernel driver NTFS3 was included. It must be whitelisted as a permitted mount target.

19 months agoAdded missing file, update release process docs.
Nikolaus Rath [Tue, 8 Aug 2023 10:23:37 +0000 (11:23 +0100)]
Added missing file, update release process docs.

19 months agoReleased fuse-3.16.1 fuse-3.16.1
Nikolaus Rath [Tue, 8 Aug 2023 10:15:03 +0000 (11:15 +0100)]
Released fuse-3.16.1

19 months agoDon't attempt to put signify signature into gz header
Nikolaus Rath [Wed, 5 Jul 2023 17:58:05 +0000 (18:58 +0100)]
Don't attempt to put signify signature into gz header

This is currently buggy, cf. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1042837

19 months agoMake errnum-verification more flexible (#824)
ikbenlike [Sat, 5 Aug 2023 20:39:09 +0000 (22:39 +0200)]
Make errnum-verification more flexible (#824)

Instead of hardcoding the value to check against, use a more dynamic method to verify the error number before passing it to the kernel.

19 months agoPass cache_readdir and keep_cache from high level API (#822)
Aleksandr Mikhailov [Thu, 3 Aug 2023 17:01:46 +0000 (19:01 +0200)]
Pass cache_readdir and keep_cache from high level API (#822)

* Pass cache_readdir and keep_cache from high level API

* Update ChangeLog.rst

20 months agoAdd dependabot for GHA
Pedro Kaj Kjellerup Nacht [Wed, 26 Jul 2023 13:48:26 +0000 (13:48 +0000)]
Add dependabot for GHA

Signed-off-by: Pedro Kaj Kjellerup Nacht <pnacht@google.com>
20 months agoHash-pin workflow Actions
Pedro Kaj Kjellerup Nacht [Wed, 26 Jul 2023 13:48:07 +0000 (13:48 +0000)]
Hash-pin workflow Actions

Signed-off-by: Pedro Kaj Kjellerup Nacht <pnacht@google.com>
20 months agoAllow linking with mold / fix the version script (#814)
Bernd Schubert [Fri, 7 Jul 2023 15:18:38 +0000 (17:18 +0200)]
Allow linking with mold / fix the version script (#814)

This fixes issue https://github.com/libfuse/libfuse/issues/810
and should avoid mold linking errors.
Commit d4e294b removed made fuse_register_module() a static
function, but forgot to remove it from the version script.

Commit fe4f942 introduced copy_file_range to libfuse and
added the non-exiting (neither declared nor defined) function
fuse_reply_copy_file_range() to the version script. Kernel
side just exects an integer reply how much was copied, using
fuse_reply_write() as in fuse_lib_copy_file_range() is sufficient
and no extra function is needed.

Co-authored-by: Bernd Schubert <bschubert@ddn.com>
20 months agoUse signify to sign releases.
Nikolaus Rath [Wed, 5 Jul 2023 10:03:07 +0000 (11:03 +0100)]
Use signify to sign releases.

20 months agoMerge tag 'fuse-3.15.1'
Nikolaus Rath [Wed, 5 Jul 2023 10:25:13 +0000 (11:25 +0100)]
Merge tag 'fuse-3.15.1'

20 months agoReleased fuse-3.15.1 fuse-3.15.1
Nikolaus Rath [Wed, 5 Jul 2023 10:14:33 +0000 (11:14 +0100)]
Released fuse-3.15.1

21 months agoReduce default write size by half
Nikolaus Rath [Sat, 1 Jul 2023 13:12:44 +0000 (14:12 +0100)]
Reduce default write size by half

Hopefully this will reduce test flakiness on CI.

21 months agoAdd missing include.
Nikolaus Rath [Sat, 1 Jul 2023 13:10:28 +0000 (14:10 +0100)]
Add missing include.

21 months agoMake expire only function fail if no kernel support (#789)
HereThereBeDragons [Fri, 30 Jun 2023 12:57:06 +0000 (14:57 +0200)]
Make expire only function fail if no kernel support (#789)

21 months agoClarify behavior of fuse_session_exit().
Nikolaus Rath [Thu, 29 Jun 2023 12:11:11 +0000 (13:11 +0100)]
Clarify behavior of fuse_session_exit().

21 months agoImprove wording of user_allow_other usage instructions (#806)
Waldir Pimenta [Mon, 19 Jun 2023 20:00:12 +0000 (21:00 +0100)]
Improve wording of user_allow_other usage instructions (#806)

* Improve wording of user_allow_other usage instructions

* Remove dated comment from mount_max usage instructions

21 months agoWrapper around test applications for cross compiler environment in meson.build (...
Rudi Heitbaum [Tue, 13 Jun 2023 10:02:01 +0000 (20:02 +1000)]
Wrapper around test applications for cross compiler environment in meson.build (#804)

This enhances commit 7be56c57f93e3436b1fbd9ecc320de5c03a3e4b8 to allow build
fuse to be built using a cross compiler

Fixes:
../meson.build:180:12: ERROR: Can not run test applications in this cross environment.

21 months agoReleased 3.15.0 fuse-3.15.0
Nikolaus Rath [Fri, 9 Jun 2023 09:36:28 +0000 (10:36 +0100)]
Released 3.15.0

21 months agoError handling for fusermount's commfd (#786)
Matthias Görgens [Thu, 8 Jun 2023 10:47:45 +0000 (18:47 +0800)]
Error handling for fusermount's commfd (#786)

21 months agoutil/meson.build: don't install udev.rules if udevdir cannot be determined (#801)
wdlkmpx [Thu, 8 Jun 2023 10:24:43 +0000 (05:24 -0500)]
util/meson.build: don't install udev.rules if udevdir cannot be determined (#801)

make the udev dependency optional

just show a big warning if `udevrulesdir` is empty

21 months agomeson.build: pass -D_FILE_OFFSET_BITS=64 to C/C++ compiler (#799)
wdlkmpx [Thu, 8 Jun 2023 10:24:28 +0000 (05:24 -0500)]
meson.build: pass -D_FILE_OFFSET_BITS=64 to C/C++ compiler (#799)

libfuse requires a 64bit off_t, it's not optional
../include/fuse_common.h:938:1: error: Kstatic assertion failed: "fuse: off_t must be 64bit"

so this only takes effect if compiling for a 32bit glibc system, it's ignored everywhere else

meson by default adds -D_FILE_OFFSET_BITS=64 to C/C++ compilers, and removes duplicate declarations
There are several opened issues in meson's git repo requesting to remove that behavior, so this makes sense even more now

this fixes compilation with muon (a C99 (mostly) meson compatible build app) in a 32bit glibc system ...

21 months agoutil/mount.fuse.c: compile with linux headers < 3.5 (#798)
wdlkmpx [Thu, 8 Jun 2023 10:23:55 +0000 (05:23 -0500)]
util/mount.fuse.c: compile with linux headers < 3.5 (#798)

PR_SET_NO_NEW_PRIVS was added in linux 3.5 according to prtcl(2) man page

https://elixir.bootlin.com/linux/v4.3/source/include/uapi/linux/prctl.h#L174

21 months agoFix memory leak (#785)
Matthias Görgens [Thu, 8 Jun 2023 10:20:56 +0000 (18:20 +0800)]
Fix memory leak (#785)

This is just to [keep address sanitizer happy](https://github.com/libfuse/libfuse/actions/runs/4730520764/jobs/8394347666?pr=784).  The OS would normally clean this up anyway.

Co-authored-by: Nikolaus Rath <Nikolaus@rath.org>
21 months agoRemove unnecessary `_GNU_SOURCE` in `fuse.c` (#787)
Matthias Görgens [Thu, 8 Jun 2023 07:26:54 +0000 (15:26 +0800)]
Remove unnecessary `_GNU_SOURCE` in `fuse.c` (#787)

We stopped using pthread_rwlock_t in 3fecccca989328ed2c0ac68860ee1ceec0673972, so we don't need `_GNU_SOURCE` anymore in `fuse.c`

21 months agoAdd security policy (#797)
Pedro Nacht [Tue, 6 Jun 2023 09:00:35 +0000 (06:00 -0300)]
Add security policy (#797)

Signed-off-by: Pedro Kaj Kjellerup Nacht <pnacht@google.com>
22 months agoAdd minimal token permissions
Pedro Kaj Kjellerup Nacht [Thu, 18 May 2023 20:47:33 +0000 (20:47 +0000)]
Add minimal token permissions

Signed-off-by: Pedro Kaj Kjellerup Nacht <pnacht@google.com>
22 months agoAdd support for running xfstests.
Nikolaus Rath [Fri, 17 Mar 2023 09:56:55 +0000 (09:56 +0000)]
Add support for running xfstests.

22 months agoDo not daemonize to early
Nikolaus Rath [Fri, 17 Mar 2023 09:04:28 +0000 (09:04 +0000)]
Do not daemonize to early

fuse_session_mount() may print errors to stderr, if we daemonize before
that than these are lost.

22 months agoDo not pass unsupported mount options to the kernel.
Nikolaus Rath [Mon, 8 May 2023 23:12:08 +0000 (16:12 -0700)]
Do not pass unsupported mount options to the kernel.

The filesystem daemon is responsible for implementing eg. st_atime updates, so passing
options like relatime to the kernel results in them being silently ignored. Instead, such
options need to be interpreted (and filtered out) by the filesystem daemon.

22 months agoFix issue #746. (#782)
Peri [Thu, 11 May 2023 01:38:46 +0000 (02:38 +0100)]
Fix issue #746. (#782)

Added a secondary check in fuse_lib_unlink() after hide_node()
to check again under a lock if the (now hidden) file is still open.
If not then delete it.

This should synchronise fuse_lib_unlink() with fuse_lib_release(),
when nullpath_ok is set.

23 months agoFix memory leak in high level API (#781)
Matthias Görgens [Fri, 14 Apr 2023 11:19:03 +0000 (19:19 +0800)]
Fix memory leak in high level API (#781)

Previously, in the high level API if we received a signal between
setting up signal handlers and processing INIT, we would leak

```
$ ./example/hello -s -d -f mountpoint/
[9/9] Linking target example/hello_ll
FUSE library version: 3.14.1
nullpath_ok: 0

=================================================================
==178330==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 352 byte(s) in 1 object(s) allocated from:
    #0 0x7fbb19abf411 in __interceptor_calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:77
    #1 0x7fbb1a0efd3b in fuse_fs_new ../lib/fuse.c:4814
    #2 0x7fbb1a0f02b5 in fuse_new_31 ../lib/fuse.c:4913
    #3 0x7fbb1a10ec5e in fuse_main_real ../lib/helper.c:345
    #4 0x5625db8ab418 in main ../example/hello.c:176
    #5 0x7fbb1983c78f  (/usr/lib/libc.so.6+0x2378f)

SUMMARY: AddressSanitizer: 352 byte(s) leaked in 1 allocation(s).
```

That's because `fuse_lowlevel.c`s `fuse_session_destroy` would only call
the user supplied `op.destroy`, if INIT had been processed, but the high
level API relied on `op.destroy` to free `f->fs`.

This patch moves the freeing into `fuse_destroy` that will always be
called by our high-level API.