doc/share/security/patches/SA-01:30/fs.patch
Bjoern A. Zeeb 3571e53040 Import FreeBSD Security Advisories and Errata Notices, as well as their
patches for easier mirroring, to eliminate a special copy, to make
www.freebsd.org/security a full copy of security.freebsd.org and be
eventually be the same.

For now files are just sitting there.   The symlinks are missing.

Discussed on:	www (repository location)
Discussed with:	simon (so)
2012-08-15 06:19:40 +00:00

56 lines
1.9 KiB
Diff

Index: sys/ufs/ufs/ufs_readwrite.c
===================================================================
RCS file: /usr2/ncvs/src/sys/ufs/ufs/ufs_readwrite.c,v
retrieving revision 1.65.2.4
retrieving revision 1.65.2.5
diff -u -r1.65.2.4 -r1.65.2.5
--- sys/ufs/ufs/ufs_readwrite.c 2000/12/11 07:33:22 1.65.2.4
+++ sys/ufs/ufs/ufs_readwrite.c 2000/12/22 18:44:34 1.65.2.5
@@ -468,10 +468,19 @@
if (uio->uio_offset + xfersize > ip->i_size)
vnode_pager_setsize(vp, uio->uio_offset + xfersize);
+ /*
+ * Avoid a data-consistency race between write() and mmap()
+ * by ensuring that newly allocated blocks are zerod. The
+ * race can occur even in the case where the write covers
+ * the entire block.
+ */
+ flags |= B_CLRBUF;
+#if 0
if (fs->fs_bsize > xfersize)
flags |= B_CLRBUF;
else
flags &= ~B_CLRBUF;
+#endif
/* XXX is uio->uio_offset the right thing here? */
error = VOP_BALLOC(vp, uio->uio_offset, xfersize,
ap->a_cred, flags, &bp);
Index: sys/gnu/ext2fs/ext2_readwrite.c
===================================================================
RCS file: /usr2/ncvs/src/sys/gnu/ext2fs/ext2_readwrite.c,v
retrieving revision 1.18.2.1
retrieving revision 1.18.2.2
diff -u -r1.18.2.1 -r1.18.2.2
--- sys/gnu/ext2fs/ext2_readwrite.c 2000/04/26 20:36:30 1.18.2.1
+++ sys/gnu/ext2fs/ext2_readwrite.c 2000/12/22 18:44:33 1.18.2.2
@@ -238,10 +238,19 @@
if (uio->uio_offset + xfersize > ip->i_size)
vnode_pager_setsize(vp, uio->uio_offset + xfersize);
+ /*
+ * Avoid a data-consistency race between write() and mmap()
+ * by ensuring that newly allocated blocks are zerod. The
+ * race can occur even in the case where the write covers
+ * the entire block.
+ */
+ flags |= B_CLRBUF;
+#if 0
if (fs->s_frag_size > xfersize)
flags |= B_CLRBUF;
else
flags &= ~B_CLRBUF;
+#endif
error = ext2_balloc(ip,
lbn, blkoffset + xfersize, ap->a_cred, &bp, flags);