svn commit: r242011 - head/sys/vm
Konstantin Belousov
kib at FreeBSD.org
Wed Oct 24 18:22:00 UTC 2012
Author: kib
Date: Wed Oct 24 18:21:59 2012
New Revision: 242011
URL: http://svn.freebsd.org/changeset/base/242011
Log:
Dirty the newly copied anonymous pages after the wired region is
forked. Otherwise, pagedaemon might reclaim the page without saving
its content into the swap file, resulting in the valid content
replaced by zeroes.
Reported and tested by: pho
Reviewed and comment update by: alc
MFC after: 1 week
Modified:
head/sys/vm/vm_fault.c
Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c Wed Oct 24 18:21:22 2012 (r242010)
+++ head/sys/vm/vm_fault.c Wed Oct 24 18:21:59 2012 (r242011)
@@ -1287,9 +1287,11 @@ vm_fault_copy_entry(vm_map_t dst_map, vm
access &= ~VM_PROT_WRITE;
/*
- * Loop through all of the pages in the entry's range, copying each
- * one from the source object (it should be there) to the destination
- * object.
+ * Loop through all of the pages in the entry's range, copying
+ * each one from the source object (it should be there) to the
+ * destination object. Note that copied pages are not wired
+ * and marked dirty to prevent reclamation without saving the
+ * content into the swap file on pageout.
*/
for (vaddr = dst_entry->start, dst_pindex = 0;
vaddr < dst_entry->end;
@@ -1332,6 +1334,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm
pmap_copy_page(src_m, dst_m);
VM_OBJECT_UNLOCK(object);
dst_m->valid = VM_PAGE_BITS_ALL;
+ dst_m->dirty = VM_PAGE_BITS_ALL;
VM_OBJECT_UNLOCK(dst_object);
/*
More information about the svn-src-all
mailing list