Date: Mon, 28 Mar 2022 22:13:46 GMT From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: c1970a7ebab5 - main - nfscl: Fix IO_APPEND writes from kernel space Message-ID: <202203282213.22SMDkUd041289@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=c1970a7ebab582d19694c9a525ed6eb4512fdb73 commit c1970a7ebab582d19694c9a525ed6eb4512fdb73 Author: Rick Macklem <rmacklem@FreeBSD.org> AuthorDate: 2022-03-28 22:11:52 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> CommitDate: 2022-03-28 22:11:52 +0000 nfscl: Fix IO_APPEND writes from kernel space Commit 867c27c23a5c modified the NFS client so that it did IO_APPEND writes directly to the NFS server bypassing the buffer cache, via a call to nfs_directio_write(). Unfortunately, this (very old) function assumed that the uio iov was for user space addresses. As such, a IO_APPEND VOP_WRITE() that was for system space, such as ktrace(1) does, would write bogus data. This patch fixes nfs_directio_write() so that it handles kernel space uio iovs. Reported by: bz Tested by: bz MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clbio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index 00a3e5d12dd7..3103d87fc8af 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -780,7 +780,7 @@ do_sync: uio.uio_iovcnt = 1; uio.uio_offset = uiop->uio_offset; uio.uio_resid = size; - uio.uio_segflg = UIO_USERSPACE; + uio.uio_segflg = uiop->uio_segflg; uio.uio_rw = UIO_WRITE; uio.uio_td = td; iomode = NFSWRITE_FILESYNC;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202203282213.22SMDkUd041289>