aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2012-10-24 18:21:59 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2012-10-24 18:21:59 +0000
commitbc79b37f2c911b81f09f9faebd1ce07e23519806 (patch)
tree554a9c7b520cb733b297b2e6b5488211cade19f1 /sys
parent9065aa649727344dc64f324359613fcf7af7967b (diff)
downloadsrc-bc79b37f2c911b81f09f9faebd1ce07e23519806.tar.gz
src-bc79b37f2c911b81f09f9faebd1ce07e23519806.zip
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
Notes
Notes: svn path=/head/; revision=242011
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/vm_fault.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index a3a90c6dcce1..ceee8f5a14ea 100644
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -1287,9 +1287,11 @@ vm_fault_copy_entry(vm_map_t dst_map, vm_map_t src_map,
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_map_t src_map,
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);
/*