Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145387523
D19615.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D19615.id.diff
View Options
Index: head/sys/vm/vm_fault.c
===================================================================
--- head/sys/vm/vm_fault.c
+++ head/sys/vm/vm_fault.c
@@ -1757,8 +1757,7 @@
}
pmap_copy_page(src_m, dst_m);
VM_OBJECT_RUNLOCK(object);
- dst_m->valid = VM_PAGE_BITS_ALL;
- dst_m->dirty = VM_PAGE_BITS_ALL;
+ dst_m->dirty = dst_m->valid = src_m->valid;
} else {
dst_m = src_m;
if (vm_page_sleep_if_busy(dst_m, "fltupg"))
@@ -1771,8 +1770,6 @@
*/
break;
vm_page_xbusy(dst_m);
- KASSERT(dst_m->valid == VM_PAGE_BITS_ALL,
- ("invalid dst page %p", dst_m));
}
VM_OBJECT_WUNLOCK(dst_object);
@@ -1780,9 +1777,18 @@
* Enter it in the pmap. If a wired, copy-on-write
* mapping is being replaced by a write-enabled
* mapping, then wire that new mapping.
+ *
+ * The page can be invalid if the user called
+ * msync(MS_INVALIDATE) or truncated the backing vnode
+ * or shared memory object. In this case, do not
+ * insert it into pmap, but still do the copy so that
+ * all copies of the wired map entry have similar
+ * backing pages.
*/
- pmap_enter(dst_map->pmap, vaddr, dst_m, prot,
- access | (upgrade ? PMAP_ENTER_WIRED : 0), 0);
+ if (dst_m->valid == VM_PAGE_BITS_ALL) {
+ pmap_enter(dst_map->pmap, vaddr, dst_m, prot,
+ access | (upgrade ? PMAP_ENTER_WIRED : 0), 0);
+ }
/*
* Mark it no longer busy, and put it on the active list.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 20, 4:22 AM (12 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28894732
Default Alt Text
D19615.id.diff (1 KB)
Attached To
Mode
D19615: vm_fault_copy_entry: accept invalid source pages.
Attached
Detach File
Event Timeline
Log In to Comment