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
This commit is contained in:
Konstantin Belousov 2012-10-24 18:21:59 +00:00
parent 9065aa6497
commit bc79b37f2c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=242011

View File

@ -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);
/*