[Bug 292618] net/samba422: on ZFS STATUS_INTERNAL_ERROR, Input/output error from vfs_freebsd.c

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 20 Jan 2026 19:48:42 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292618

            Bug ID: 292618
           Summary: net/samba422: on ZFS STATUS_INTERNAL_ERROR,
                    Input/output error from vfs_freebsd.c
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: samba@FreeBSD.org
          Reporter: daveb@spectralogic.com
          Assignee: samba@FreeBSD.org
             Flags: maintainer-feedback?(samba@FreeBSD.org)

vfs_freebsd.c uses strlcpy(3) with overlapping source and destination; as man
strlcpy(3) states:

"If the src and dst strings overlap, the behavior is undefined."

New compilers, loader, ... whatever on FreeBSD 14.3 are now exposing this bug.
See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292528 for a simple test
case that demonstrates this strlcpy() restriction; the test case mimics the
following code in vfs_freebsd_.c::freebsd_extattr_list():

    for(list_size = 0, p = q = list; p < list_end; p += len) {
        len = p[0] + 1;
        (void)strlcpy(q, p + 1, len);

For example, when the extended attribute is "\005NTACL" the above code
truncates list[] to "NTAC" and sets len to 6.

The caller of freebsd_extattr_list() is smb2_trans2.c::get_ea_names_from_fsp()
which catches the error here:
        /*
         * Ensure the result is 0-terminated
         */
        if (ea_namelist[sizeret-1] != '\0') {
                TALLOC_FREE(to_free);
                return NT_STATUS_INTERNAL_ERROR;
        }

get_ea_names_from_fsp() executed in response to "GetInfo Request
FILE_INFO/SMB2_FILE_FULL_EA_INFO" The client receives the following response
(partial wireshark lines):

11    1.425754712    1.2.3.4    4.3.2.1    SMB2    174    GetInfo Request
FILE_INFO/SMB2_FILE_FULL_EA_INFO
12    1.428214098    4.3.2.1    1.2.3.4    SMB2    143    GetInfo Response,
Error: STATUS_INTERNAL_ERROR

A linux client reports "IO error":
% ls -al
ls: .: Input/output error
ls: ..: Input/output error
ls: a: Input/output error
ls: passwd: Input/output error
total 5
drwxrwxrwx 2 root root    0 Jan 19 15:36 .
drwxrwxrwx 2 root root    0 Jan 19 15:09 ..
drwxrwxrwx 2 root root    0 Jan 19 15:36 a
-rwxrwxrwx 1 root root 3565 Jan 19 15:36 passwd

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