Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151032829
D54219.id168174.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
D54219.id168174.diff
View Options
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -2091,6 +2091,8 @@
vm_pindex_t p;
p = swap_pager_seek_data(obj, OFF_TO_IDX(noff));
+ if (p == OBJ_MAX_SIZE)
+ p = obj->size;
return (p == OFF_TO_IDX(noff) ? noff : IDX_TO_OFF(p));
}
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -2460,7 +2460,8 @@
vm_page_t m;
vm_pindex_t swap_index;
- VM_OBJECT_ASSERT_RLOCKED(object);
+ VM_OBJECT_ASSERT_LOCKED(object);
+ KASSERT((object->flags & OBJ_SWAP) != 0, ("non-swap obj %p", object));
vm_page_iter_init(&pages, object);
m = vm_radix_iter_lookup_ge(&pages, pindex);
if (m != NULL && pages.index == pindex && vm_page_any_valid(m))
@@ -2478,8 +2479,6 @@
return (pages.index);
m = vm_radix_iter_step(&pages);
}
- if (swap_index == OBJ_MAX_SIZE)
- swap_index = object->size;
return (swap_index);
}
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -2244,6 +2244,23 @@
if (next_pindex + next_size > prev_object->size)
prev_object->size = next_pindex + next_size;
+#ifdef INVARIANTS
+ /*
+ * Re-check: there must be no pages in the next range backed
+ * by prev_entry's object. Otherwise, the resulting
+ * corruption is same as faulting in non-zeroed page.
+ */
+ if (vm_check_pg_zero) {
+ vm_pindex_t pidx;
+
+ pidx = swap_pager_seek_data(prev_object, next_pindex);
+ KASSERT(pidx >= next_pindex + next_size,
+ ("found obj %p pindex %#jx e %#jx %#jx %#jx",
+ prev_object, pidx, (uintmax_t)prev_offset,
+ (uintmax_t)prev_size, (uintmax_t)next_size));
+ }
+#endif
+
VM_OBJECT_WUNLOCK(prev_object);
return (TRUE);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 6, 1:52 PM (17 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30974186
Default Alt Text
D54219.id168174.diff (1 KB)
Attached To
Mode
D54219: vm_object_coalesce(): check that coalescing does not revive stale pages
Attached
Detach File
Event Timeline
Log In to Comment