From nobody Thu Jul 09 04:53:38 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gwjKH1yqjz6kW9x for ; Thu, 09 Jul 2026 04:53:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwjKH0znxz3BpZ for ; Thu, 09 Jul 2026 04:53:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783572819; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tVKfKfSxBuo7NOqV969pPSfGwHs33kzOi0hKbrYYasw=; b=O1ZX4CaDcr+hbQKiykb/P/qlRuk962SZGZKpf2lg+nXR7abVYzB4qdhFKMKR/+lP4x29b8 Ea/QNZQdOE2oBr/Hn3ZnbTM/MZHYtk8/+0yefGBqEKL7vUDT8jETwiiLS0gdPXPpWd2Bkw SZeO/6lLnSTXn215PLx/1yXGBFekSRviA04cucFbhF8DZMTU8ffMZKYoX8Er9YR1ZxiR5S z3pUv0b67UKnzHnRXMlAJRPfjTgJ2t3VFi/1yTgUKm+IJiiYdRIbCm3sbLAQ1DUIp/hSX8 urRFUcjaJxjCk6zyzL0Hylf+7Op4UHjyQQJQDDUgJRJskJjSn/WZl0In+d1NoA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783572819; a=rsa-sha256; cv=none; b=Ud5uPNrPzuWuDyFOmMG+zqYwZNSxLyIOqYxLMatu7gUagjwkG4f6s+hCq2Ke38F7hQrlfe /7bh77IFxUa7aeZVbQ1vB9YhZ78G4yeLVT/47cktGS7dTT4bPefBlpbFho1ZI+5NZEEMGH pO9k2xe3mTFatl8esCM73XHIaHkz10Q5E0CboqD6XkESc1Dv1An2zBWEG2pyJ3UuhpOHd6 Jfrub8OSL6QcikSD7FXj7tuge74iwbSm85DR4wpejvHbpHltLWp8aWr6PKjPq+27/P4V4N H50MoAnwe5nt6G7Svwatw3iuxikxqE9oy0u5JqeV28a3u5XFdELl4sRTrFj2LQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783572819; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tVKfKfSxBuo7NOqV969pPSfGwHs33kzOi0hKbrYYasw=; b=KZp3aagnzXzJQuN/AV7ddc3s+Dm4hoFCQ+20opC2ACtNWn7hD2675kCF4PS65FOfXChdEG uTvMRn03SZc0yHbpk9HIAtZ7OnQk3dUxk3hz3z/vg7DGllPQb5/jXXskxChWkVrpSXpEZ8 rrsSL3aSi2+GqkJAuN2gWrHzOf/9Dik8ZC7aLZ5osZiLCi2AK/MSxmb3YhA3uTldTmd0k6 41Z4w9GeSxVcc03JZdq2kDq+q8K2KC1oAVleqvBcDjQbnEInxw+m4ioodhnnfYgIedVjfY o/fVIv7C7vNQjokcIQvEfphpvadc6RlXDvmjK1hj5k9TsbbJpP6XNPRnuQm1NQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwjKG7236zv52 for ; Thu, 09 Jul 2026 04:53:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 379a2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 04:53:38 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 1364d8fd9b25 - main - kern_writefile(): fix several regressions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1364d8fd9b25d6d3e9618e7be073a1a1b41aa19c Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 04:53:38 +0000 Message-Id: <6a4f2952.379a2.37ac66e3@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1364d8fd9b25d6d3e9618e7be073a1a1b41aa19c commit 1364d8fd9b25d6d3e9618e7be073a1a1b41aa19c Author: Konstantin Belousov AuthorDate: 2026-07-08 19:21:00 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-09 04:53:23 +0000 kern_writefile(): fix several regressions sendfile(): for trailers uio, set uio_rw to UIO_WRITE instead of checking it kern_filewrite(): remove unused argument offset kern_writev(): the check should compare cnt against zero, not uio_resid Reported by: markj Fixes: dfad790c8cca ("sendfile: stop abusing kern_writev()") Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/kern_sendfile.c | 8 ++------ sys/kern/sys_generic.c | 6 +++--- sys/sys/syscallsubr.h | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c index 1a534210ca0c..f975470e6dcf 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -1175,8 +1175,7 @@ prepend_header: SOCK_IO_SEND_UNLOCK(so); CURVNET_RESTORE(); - error = kern_filewrite(td, sockfd, sock_fp, trl_uio, - (off_t)-1, 0, &cnt); + error = kern_filewrite(td, sockfd, sock_fp, trl_uio, 0, &cnt); if (error == 0) sbytes += cnt; goto out; @@ -1256,10 +1255,7 @@ sendfile(struct thread *td, struct sendfile_args *uap, int compat) &trl_uio); if (error != 0) goto out; - if (trl_uio->uio_rw != UIO_WRITE) { - error = EINVAL; - goto out; - } + trl_uio->uio_rw = UIO_WRITE; trl_uio->uio_td = td; } } diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index d5145d6cf322..bbfeebbe2f2e 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -555,7 +555,7 @@ dofilewrite(struct thread *td, int fd, struct file *fp, struct uio *auio, auio->uio_rw = UIO_WRITE; auio->uio_td = td; auio->uio_offset = offset; - error = kern_filewrite(td, fd, fp, auio, offset, flags, &cnt); + error = kern_filewrite(td, fd, fp, auio, flags, &cnt); /* * Handle short writes and generate SIGPIPE if needed. @@ -563,7 +563,7 @@ dofilewrite(struct thread *td, int fd, struct file *fp, struct uio *auio, * see sousrsend(). */ if (error != 0 && fp->f_type != DTYPE_SOCKET) { - if (auio->uio_resid != cnt && (error == ERESTART || + if (cnt != 0 && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) error = 0; if (error == EPIPE) { @@ -584,7 +584,7 @@ dofilewrite(struct thread *td, int fd, struct file *fp, struct uio *auio, */ int kern_filewrite(struct thread *td, int fd, struct file *fp, struct uio *auio, - off_t offset, int flags, ssize_t *cntp) + int flags, ssize_t *cntp) { ssize_t cnt; int error; diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index 131a8925a2d4..f0652806b999 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -177,7 +177,7 @@ int kern_fhopen(struct thread *td, const struct fhandle *u_fhp, int flags); int kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf); int kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf); int kern_filewrite(struct thread *td, int fd, struct file *fp, - struct uio *auio, off_t offset, int flags, ssize_t *cntp); + struct uio *auio, int flags, ssize_t *cntp); int kern_fpathconf(struct thread *td, int fd, int name, long *valuep); int kern_freebsd11_getfsstat(struct thread *td, struct freebsd11_statfs *ubuf, long bufsize, int mode);