From: Martin Pieuchot Subject: Update assertions in pgo_get() To: tech@openbsd.org Date: Wed, 18 Dec 2024 17:48:56 +0100 The two pgo_get() implementations no longer modify pages when PGO_LOCKED is passed. They are ready to be called with a shared lock, so update the assertions to reflect that. ok? diff --git sys/uvm/uvm_aobj.c sys/uvm/uvm_aobj.c index 8176f22a6a4..e8a97454a42 100644 --- sys/uvm/uvm_aobj.c +++ sys/uvm/uvm_aobj.c @@ -999,7 +999,9 @@ uao_get(struct uvm_object *uobj, voff_t offset, struct vm_page **pps, boolean_t done; KASSERT(UVM_OBJ_IS_AOBJ(uobj)); - KASSERT(rw_write_held(uobj->vmobjlock)); + KASSERT(rw_lock_held(uobj->vmobjlock)); + KASSERT(rw_write_held(uobj->vmobjlock) || + ((flags & PGO_LOCKED) != 0 && (access_type & PROT_WRITE) == 0)); /* * get number of pages diff --git sys/uvm/uvm_vnode.c sys/uvm/uvm_vnode.c index d9fc19f6dcb..17e3853b1a0 100644 --- sys/uvm/uvm_vnode.c +++ sys/uvm/uvm_vnode.c @@ -950,8 +950,9 @@ uvn_get(struct uvm_object *uobj, voff_t offset, struct vm_page **pps, int lcv, result, gotpages; boolean_t done; - KASSERT(((flags & PGO_LOCKED) != 0 && rw_lock_held(uobj->vmobjlock)) || - (flags & PGO_LOCKED) == 0); + KASSERT(rw_lock_held(uobj->vmobjlock)); + KASSERT(rw_write_held(uobj->vmobjlock) || + ((flags & PGO_LOCKED) != 0 && (access_type & PROT_WRITE) == 0)); /* step 1: handled the case where fault data structures are locked. */ if (flags & PGO_LOCKED) {