mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-25 10:01:02 +01:00
swap-like pagers: assert that writemapping decrease does not pass zero
Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D45119
This commit is contained in:
parent
58d7ac11e7
commit
6ada4e8a0a
@ -183,6 +183,9 @@ tmpfs_pager_release_writecount(vm_object_t object, vm_offset_t start,
|
||||
KASSERT((object->flags & OBJ_ANON) == 0,
|
||||
("%s: object %p with OBJ_ANON", __func__, object));
|
||||
old = object->un_pager.swp.writemappings;
|
||||
KASSERT(old >= (vm_ooffset_t)end - start,
|
||||
("tmpfs obj %p writecount %jx dec %jx", object, (uintmax_t)old,
|
||||
(uintmax_t)((vm_ooffset_t)end - start)));
|
||||
object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start;
|
||||
new = object->un_pager.swp.writemappings;
|
||||
tmpfs_pager_writecount_recalc(object, old, new);
|
||||
|
@ -3158,6 +3158,10 @@ swap_pager_release_writecount(vm_object_t object, vm_offset_t start,
|
||||
VM_OBJECT_WLOCK(object);
|
||||
KASSERT((object->flags & OBJ_ANON) == 0,
|
||||
("Splittable object with writecount"));
|
||||
KASSERT(object->un_pager.swp.writemappings >= (vm_ooffset_t)end - start,
|
||||
("swap obj %p writecount %jx dec %jx", object,
|
||||
(uintmax_t)object->un_pager.swp.writemappings,
|
||||
(uintmax_t)((vm_ooffset_t)end - start)));
|
||||
object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start;
|
||||
VM_OBJECT_WUNLOCK(object);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user