[Bug 295537] linuxulator: O_PATH file descriptors return wrong errno for mmap(2) and f*xattr(2)

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 24 May 2026 01:37:18 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295537

            Bug ID: 295537
           Summary: linuxulator: O_PATH file descriptors return wrong
                    errno for mmap(2) and f*xattr(2)
           Product: Base System
           Version: 15.1-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: mr.yaoxin@outlook.com

The Linuxulator currently returns incorrect error codes when some
file-descriptor
based operations are attempted on an O_PATH descriptor.

In particular, LTP open13 expects these operations to fail with EBADF, matching
Linux behavior, but FreeBSD currently returns different errors:

- mmap() on an O_PATH fd returns EACCES
- fgetxattr() on an O_PATH fd returns EOPNOTSUPP

The same issue also affects other fd-based xattr operations, which should
follow
the same O_PATH semantics for consistency:

 - fsetxattr()
 - fremovexattr()
 - flistxattr()

This appears to be a Linux compatibility bug rather than a functional
limitation.
For mmap(), the Linuxulator does not currently reject path_fileops descriptors
early with EBADF. For xattr operations, the code reaches the extattr path and 
returns the underlying FreeBSD error instead of recognizing that an O_PATH fd
is
not a valid data-access descriptor for these operations.

This is addressed by
https://github.com/freebsd/freebsd-src/pull/2181

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