Date: Fri, 11 Nov 2016 20:08:46 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308552 - stable/10/sys/fs/msdosfs Message-ID: <201611112008.uABK8k29014305@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Fri Nov 11 20:08:45 2016 New Revision: 308552 URL: https://svnweb.freebsd.org/changeset/base/308552 Log: MFC r308025: Enable vn_io_fault() deadlock avoidance for msdosfs. Modified: stable/10/sys/fs/msdosfs/msdosfs_vfsops.c stable/10/sys/fs/msdosfs/msdosfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/10/sys/fs/msdosfs/msdosfs_vfsops.c Fri Nov 11 20:06:07 2016 (r308551) +++ stable/10/sys/fs/msdosfs/msdosfs_vfsops.c Fri Nov 11 20:08:45 2016 (r308552) @@ -743,7 +743,7 @@ mountmsdosfs(struct vnode *devvp, struct mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum; MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_USES_BCACHE; + mp->mnt_kern_flag |= MNTK_USES_BCACHE | MNTK_NO_IOPF; MNT_IUNLOCK(mp); if (pmp->pm_flags & MSDOSFS_LARGEFS) Modified: stable/10/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- stable/10/sys/fs/msdosfs/msdosfs_vnops.c Fri Nov 11 20:06:07 2016 (r308551) +++ stable/10/sys/fs/msdosfs/msdosfs_vnops.c Fri Nov 11 20:08:45 2016 (r308552) @@ -640,7 +640,7 @@ msdosfs_read(ap) diff = blsize - bp->b_resid; if (diff < n) n = diff; - error = uiomove(bp->b_data + on, (int) n, uio); + error = vn_io_fault_uiomove(bp->b_data + on, (int) n, uio); brelse(bp); } while (error == 0 && uio->uio_resid > 0 && n != 0); if (!isadir && (error == 0 || uio->uio_resid != orig_resid) && @@ -776,6 +776,12 @@ msdosfs_write(ap) * then no need to read data from disk. */ bp = getblk(thisvp, bn, pmp->pm_bpcluster, 0, 0, 0); + /* + * This call to vfs_bio_clrbuf() ensures that + * even if vn_io_fault_uiomove() below faults, + * garbage from the newly instantiated buffer + * is not exposed to the userspace via mmap(). + */ vfs_bio_clrbuf(bp); /* * Do the bmap now, since pcbmap needs buffers @@ -813,7 +819,7 @@ msdosfs_write(ap) /* * Copy the data from user space into the buf header. */ - error = uiomove(bp->b_data + croffset, n, uio); + error = vn_io_fault_uiomove(bp->b_data + croffset, n, uio); if (error) { brelse(bp); break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611112008.uABK8k29014305>