Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167418913
D57536.id179586.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D57536.id179586.diff
View Options
diff --git a/sys/fs/fuse/fuse_io.c b/sys/fs/fuse/fuse_io.c
--- a/sys/fs/fuse/fuse_io.c
+++ b/sys/fs/fuse/fuse_io.c
@@ -935,51 +935,9 @@
int
fuse_io_invalbuf(struct vnode *vp, struct thread *td)
{
- struct fuse_vnode_data *fvdat = VTOFUD(vp);
- int error = 0;
-
if (VN_IS_DOOMED(vp))
return 0;
- ASSERT_VOP_ELOCKED(vp, "fuse_io_invalbuf");
-
- while (fvdat->flag & FN_FLUSHINPROG) {
- struct proc *p = td->td_proc;
-
- if (vp->v_mount->mnt_kern_flag & MNTK_UNMOUNTF)
- return EIO;
- fvdat->flag |= FN_FLUSHWANT;
- tsleep(&fvdat->flag, PRIBIO, "fusevinv", 2 * hz);
- error = 0;
- if (p != NULL) {
- PROC_LOCK(p);
- if (SIGNOTEMPTY(p->p_siglist) ||
- SIGNOTEMPTY(td->td_siglist))
- error = EINTR;
- PROC_UNLOCK(p);
- }
- if (error == EINTR)
- return EINTR;
- }
- fvdat->flag |= FN_FLUSHINPROG;
-
vnode_pager_clean_sync(vp);
- error = vinvalbuf(vp, V_SAVE, PCATCH, 0);
- while (error) {
- if (error == ERESTART || error == EINTR) {
- fvdat->flag &= ~FN_FLUSHINPROG;
- if (fvdat->flag & FN_FLUSHWANT) {
- fvdat->flag &= ~FN_FLUSHWANT;
- wakeup(&fvdat->flag);
- }
- return EINTR;
- }
- error = vinvalbuf(vp, V_SAVE, PCATCH, 0);
- }
- fvdat->flag &= ~FN_FLUSHINPROG;
- if (fvdat->flag & FN_FLUSHWANT) {
- fvdat->flag &= ~FN_FLUSHWANT;
- wakeup(&fvdat->flag);
- }
- return (error);
+ return vinvalbuf(vp, V_SAVE, PCATCH, 0);
}
diff --git a/sys/fs/fuse/fuse_node.h b/sys/fs/fuse/fuse_node.h
--- a/sys/fs/fuse/fuse_node.h
+++ b/sys/fs/fuse/fuse_node.h
@@ -71,8 +71,6 @@
#include "fuse_file.h"
#define FN_REVOKED 0x00000020
-#define FN_FLUSHINPROG 0x00000040
-#define FN_FLUSHWANT 0x00000080
/*
* Indicates that the file's size is dirty; the kernel has changed it but not
* yet send the change to the daemon. When this bit is set, the
diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c
--- a/sys/fs/fuse/fuse_vnops.c
+++ b/sys/fs/fuse/fuse_vnops.c
@@ -907,7 +907,7 @@
cred = td->td_ucred;
err = fuse_flush(vp, cred, pid, fflag);
- ASSERT_CACHED_ATTRS_LOCKED(vp); /* For fvdat->flag */
+ CACHED_ATTR_LOCK(vp); /* For fvdat->flag */
if (err == 0 && (fvdat->flag & FN_ATIMECHANGE) && !vfs_isrdonly(mp)) {
struct vattr vap;
struct fuse_data *data;
@@ -938,6 +938,7 @@
if ((fvdat->flag & FN_SIZECHANGE) != 0) {
fuse_vnode_savesize(vp, cred, pid);
}
+ CACHED_ATTR_UNLOCK(vp);
return err;
}
diff --git a/tests/sys/fs/fusefs/Makefile b/tests/sys/fs/fusefs/Makefile
--- a/tests/sys/fs/fusefs/Makefile
+++ b/tests/sys/fs/fusefs/Makefile
@@ -5,6 +5,7 @@
TESTSDIR= ${TESTSBASE}/sys/fs/fusefs
ATF_TESTS_SH+= ctl
+ATF_TESTS_SH+= misc
# We could simply link all of these files into a single executable. But since
# Kyua treats googletest programs as plain tests, it's better to separate them
diff --git a/tests/sys/fs/fusefs/misc.sh b/tests/sys/fs/fusefs/misc.sh
new file mode 100644
--- /dev/null
+++ b/tests/sys/fs/fusefs/misc.sh
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (c) 2026 ConnectWise
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Regression test for https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295957
+#
+# Almost any fuse file system would work, but this tests uses fusefs-ext2
+# because it's simple and its download is very small.
+atf_test_case execute cleanup
+execute_head()
+{
+ atf_set "descr" "Execute a file mounted on a fusefs file system"
+ atf_set "require.user" "root"
+ atf_set "require.progs" "fuse-ext2 mkfs.ext2"
+ atf_set "require.kmods" "fusefs"
+}
+execute_body()
+{
+ mkdir mnt
+ truncate -s 64m ext2.img
+ mkfs.ext2 ext2.img
+ fuse-ext2 -o rw+ ext2.img mnt
+ cp /usr/bin/true mnt
+ su -m nobody -c mnt/true
+}
+execute_cleanup()
+{
+ umount $PWD/mnt
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case execute
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Aug 22, 3:35 PM (12 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37093779
Default Alt Text
D57536.id179586.diff (4 KB)
Attached To
Mode
D57536: fusefs: fix vnode locking violations during execve
Attached
Detach File
Event Timeline
Log In to Comment