diff options
author | kib <kib@FreeBSD.org> | 2012-10-24 18:21:59 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2012-10-24 18:21:59 +0000 |
commit | 2a76567642712614056aeb2c90c97db6952205b3 (patch) | |
tree | 554a9c7b520cb733b297b2e6b5488211cade19f1 /sys/vm/vm_fault.c | |
parent | 09daf9f4d2e686773cb6b74346a6e3047377aea4 (diff) | |
download | FreeBSD-src-2a76567642712614056aeb2c90c97db6952205b3.zip FreeBSD-src-2a76567642712614056aeb2c90c97db6952205b3.tar.gz |
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
Diffstat (limited to 'sys/vm/vm_fault.c')
-rw-r--r-- | sys/vm/vm_fault.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index a3a90c6..ceee8f5 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); /* |