Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm in uvm_map_clean(), add PGO_CLEANIT to the flags pas...



details:   https://anonhg.NetBSD.org/src/rev/865beacf1537
branches:  trunk
changeset: 519987:865beacf1537
user:      chs <chs%NetBSD.org@localhost>
date:      Mon Dec 31 20:34:01 2001 +0000

description:
in uvm_map_clean(), add PGO_CLEANIT to the flags passed to an object's pager.
we need to make sure that vnode pages are written to disk at least once,
otherwise processes could gain access to whatever data was previously stored
in disk blocks which are freshly allocated to a file.

diffstat:

 sys/uvm/uvm_map.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r d17b79e02899 -r 865beacf1537 sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Mon Dec 31 20:20:28 2001 +0000
+++ b/sys/uvm/uvm_map.c Mon Dec 31 20:34:01 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_map.c,v 1.115 2001/12/31 19:21:36 chs Exp $        */
+/*     $NetBSD: uvm_map.c,v 1.116 2001/12/31 20:34:01 chs Exp $        */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.115 2001/12/31 19:21:36 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.116 2001/12/31 20:34:01 chs Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
@@ -2653,6 +2653,9 @@
  flush_object:
                /*
                 * flush pages if we've got a valid backing object.
+                * note that we must always clean object pages before
+                * freeing them since otherwise we could reveal stale
+                * data from files.
                 */
 
                offset = current->offset + (start - current->start);
@@ -2660,7 +2663,7 @@
                if (uobj != NULL) {
                        simple_lock(&uobj->vmobjlock);
                        error = (uobj->pgops->pgo_put)(uobj, offset,
-                           offset + size, flags);
+                           offset + size, flags | PGO_CLEANIT);
                }
                start += size;
        }



Home | Main Index | Thread Index | Old Index