Skip to content

Regression in 3.4.3, "Invalid argument (22)" on all file reads when using native protocol #897

@moonlitbugs

Description

@moonlitbugs

In rsync 3.4.3, when doing a simple remote directory read using native protocol, we see the following regression:

rsync -av --delete imap::top/mnt/ /tmp/foo/
receiving incremental file list
rsync: [sender] send_files failed to open "/mnt/README" (in top): Invalid argument (22)

sent 51 bytes  received 322 bytes  746.00 bytes/sec
total size is 376  speedup is 1.01
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1867) [generator=3.4.3]

Here, we're talking to a remote host called "imap" using rsync module "top" (defined in rsyncd.conf with path = / and use chroot = no). Now, if we run the same command with rsync 3.4.2, we see:

rsync -av --delete imap::top/mnt/ /tmp/foo/
receiving incremental file list
README

sent 51 bytes  received 637 bytes  1,376.00 bytes/sec
total size is 376  speedup is 0.55

If we switch to using rsync over ssh, i.e. rsync -v --delete imap:/mnt/ /tmp/foo/ then it succeeds normally with the new 3.4.3 version.

Curious, I did a strace of the rsync daemon for both versions to see where the error originated. The smoking gun with version 3.4.3 is that it never even attempts to open the file it complains about.

grep README /tmp/rsync-343.trace
/tmp/rsync-343.trace:14903 newfstatat(AT_FDCWD, "README", {st_mode=S_IFREG|0644, st_size=376, ...}, AT_SYMLINK_NOFOLLOW) = 0
/tmp/rsync-343.trace:14903 access("README", R_OK)            = 0
/tmp/rsync-343.trace:14903 write(7, "\277\0\0\7\214\1\1.\0X\0E\363\231\30\355A\0\0\0\4root\0\4root\32\ncdrecorder\0\0\0E+|\30:\3\2om\0\0\0<\223\365\222\32\3dvd\0\0\0E/|\30\32\6floppy\0\0\0<\223\365\222\200\232\2hd\0\0\0\32\6memory\0\0\0E3|\30\32\3tmp\0\0\0E[|\30\32\3zip\0\0\0E6|\30\30\6README\0x\1E\363\231\30\244\201\0\0\0\0\377e\0\0\377\1\0\0\377\1\0\0\377\1\0\0\377\1\0\0\377\1\0\0\377\1\0\0\377\1\0\0\377\376\200\2\0\0", 195) = 195
/tmp/rsync-343.trace:14903 sendto(4, "<172>May 20 00:18:12 rsyncd[14903]: rsync: [sender] send_files failed to open \"/mnt/README\" (in top): Invalid argument (22)\n", 124, MSG_NOSIGNAL, NULL, 0) = 124
/tmp/rsync-343.trace:14903 write(7, "X\0\0\10rsync: [sender] send_files failed to open \"/mnt/README\" (in top): Invalid argument (22)\n\4\0\0m\2\0\0\0", 100) = 100

grep README /tmp/rsync-342.trace
/tmp/rsync-342.trace:15357 newfstatat(AT_FDCWD, "README", {st_mode=S_IFREG|0644, st_size=376, ...}, AT_SYMLINK_NOFOLLOW) = 0
/tmp/rsync-342.trace:15357 access("README", R_OK)            = 0
/tmp/rsync-342.trace:15357 write(7, "\277\0\0\7\214\1\1.\0X\0E\363\231\30\355A\0\0\0\4root\0\4root\32\ncdrecorder\0\0\0E+|\30:\3\2om\0\0\0<\223\365\222\32\3dvd\0\0\0E/|\30\32\6floppy\0\0\0<\223\365\222\200\232\2hd\0\0\0\32\6memory\0\0\0E3|\30\32\3tmp\0\0\0E[|\30\32\3zip\0\0\0E6|\30\30\6README\0x\1E\363\231\30\244\201\0\0\0\0\377e\0\0\377\1\0\0\377\1\0\0\377\1\0\0\377\1\0\0\377\1\0\0\377\1\0\0\377\1\0\0\377\376\200\2\0\0", 195) = 195
/tmp/rsync-342.trace:15357 openat(AT_FDCWD, "README", O_RDONLY|O_NOFOLLOW) = 5

On the server side, the /etc/rsyncd.conf contains the following, lightly redacted:

uid = nobody
gid = nobody
use chroot = yes
read only = yes
munge symlinks = no

[top]
        path = /
        list = no
        use chroot = no
        read only = no
        auth users = root
        uid = root
        hosts allow = ......
        ignore nonreadable = yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions