[Bug 278135] fusefs: pathconf(_PC_MIN_HOLE_SIZE) fails on new mountpoint with unopened file

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 02 Apr 2024 16:27:40 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278135

            Bug ID: 278135
           Summary: fusefs: pathconf(_PC_MIN_HOLE_SIZE) fails on new
                    mountpoint with unopened file
           Product: Base System
           Version: 15.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: asomers@FreeBSD.org

When a program calls pathconf(path, _PC_MIN_HOLE_SIZE) on a fusefs file system,
if the kernel doesn't already know whether the file system supports FUSE_LSEEK,
it must issue a FUSE_LSEEK operation to find out.  It sends that operation to
the provided path.  BUT, the current implementation neglects to ensure that a
fuse file handle is open.  That's a bug.  We never noticed it before because
the test suite only uses fpathconf, not pathconf.

Steps to Reproduce
==================
1) Mount a file system that is known to support FUSE_LSEEK
2) Without doing any open(), stat(), access(), or similar, try
pathconf("/mountpoint/hello.txt", _PC_MIN_HOLE_SIZE)
3) It ought to return 1, but it will instead fail with EINVAL

-- 
You are receiving this mail because:
You are the assignee for the bug.