Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146237920
D55536.id172897.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
D55536.id172897.diff
View Options
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -642,6 +642,8 @@
pager_last = map_last;
}
for (pidx = pager_first; pidx <= pager_last; pidx += npages) {
+ vm_prot_t sprot;
+
m = vm_page_lookup(fs->first_object, pidx);
vaddr = fs->entry->start + IDX_TO_OFF(pidx) - fs->entry->offset;
KASSERT(m != NULL && m->pindex == pidx,
@@ -652,13 +654,26 @@
!pmap_ps_enabled(fs->map->pmap)))
psind--;
+ sprot = fs->prot;
npages = atop(pagesizes[psind]);
for (i = 0; i < npages; i++) {
vm_fault_populate_check_page(&m[i]);
vm_fault_dirty(fs, &m[i]);
+
+ /*
+ * If this is a writeable superpage mapping, all
+ * constituent pages and the new mapping should be
+ * dirty, otherwise the mapping should be read-only.
+ */
+ if (psind > 0 && (sprot & VM_PROT_WRITE) != 0 &&
+ (m[i].oflags & VPO_UNMANAGED) == 0 &&
+ m[i].dirty != VM_PAGE_BITS_ALL)
+ sprot &= ~VM_PROT_WRITE;
}
+ if (psind > 0 && (sprot & VM_PROT_WRITE) != 0)
+ fs->fault_flags |= VM_PROT_WRITE;
VM_OBJECT_WUNLOCK(fs->first_object);
- rv = pmap_enter(fs->map->pmap, vaddr, m, fs->prot, fs->fault_type |
+ rv = pmap_enter(fs->map->pmap, vaddr, m, sprot, fs->fault_type |
(fs->wired ? PMAP_ENTER_WIRED : 0), psind);
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 2, 12:47 AM (7 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29083624
Default Alt Text
D55536.id172897.diff (1 KB)
Attached To
Mode
D55536: vm_fault: Avoid creating clean, writeable superpage mappings
Attached
Detach File
Event Timeline
Log In to Comment