Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/tmpfs Disable use of UBC_FAULTBUSY in tmpfs_write() f...



details:   https://anonhg.NetBSD.org/src/rev/53be8917fef3
branches:  trunk
changeset: 957878:53be8917fef3
user:      chs <chs%NetBSD.org@localhost>
date:      Sun Dec 13 19:22:02 2020 +0000

description:
Disable use of UBC_FAULTBUSY in tmpfs_write() for now,
which brings back zeroing of all new tmpfs data pages.
The existing code that enables this optimization skips the zeroing
in numerous cases where it is needed, resulting in corrupted files
and data leaks from the page's previous identity.

diffstat:

 sys/fs/tmpfs/tmpfs_vnops.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 77b4d0e59b2e -r 53be8917fef3 sys/fs/tmpfs/tmpfs_vnops.c
--- a/sys/fs/tmpfs/tmpfs_vnops.c        Sun Dec 13 19:08:20 2020 +0000
+++ b/sys/fs/tmpfs/tmpfs_vnops.c        Sun Dec 13 19:22:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tmpfs_vnops.c,v 1.144 2020/09/05 16:30:12 riastradh Exp $      */
+/*     $NetBSD: tmpfs_vnops.c,v 1.145 2020/12/13 19:22:02 chs Exp $    */
 
 /*
  * Copyright (c) 2005, 2006, 2007, 2020 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.144 2020/09/05 16:30:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.145 2020/12/13 19:22:02 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/dirent.h>
@@ -616,12 +616,19 @@
         * of PG_BUSY and the vnode lock).
         */
        ubc_flags = UBC_WRITE | UBC_VNODE_FLAGS(vp);
+#if 0
+       /*
+        * XXX disable use of UBC_FAULTBUSY for now, this check is insufficient
+        * because it does not zero uninitialized parts of pages in all of
+        * the cases where zeroing is needed.
+        */
        if (uio->uio_offset >= oldsize &&
            ((uio->uio_offset & (PAGE_SIZE - 1)) == 0 ||
            ((vp->v_vflag & VV_MAPPED) == 0 &&
            trunc_page(uio->uio_offset) == trunc_page(oldsize)))) {
                ubc_flags |= UBC_FAULTBUSY;
        }
+#endif
 
        uobj = node->tn_spec.tn_reg.tn_aobj;
        error = 0;



Home | Main Index | Thread Index | Old Index