From 1340df41e0c476cd0cf3ce3ec2af61bd95845302 Mon Sep 17 00:00:00 2001 From: mpi Date: Thu, 10 Mar 2022 10:46:56 +0000 Subject: [PATCH] Do not clear the PG_BUSY flag before passing the anon to uvm_anon_release(). Should prevent a KASSERT() from tiggering when freeing an anon after swaping-out its memory. This code path has been broken since at least January 2021 and is apparently not so easy to trigger. Found the hard way by sthen@ ok kettenis@, kn@ --- sys/uvm/uvm_page.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c index df40cd97395..57b7a52b426 100644 --- a/sys/uvm/uvm_page.c +++ b/sys/uvm/uvm_page.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_page.c,v 1.161 2022/01/19 02:08:24 mpi Exp $ */ +/* $OpenBSD: uvm_page.c,v 1.162 2022/03/10 10:46:56 mpi Exp $ */ /* $NetBSD: uvm_page.c,v 1.44 2000/11/27 08:40:04 chs Exp $ */ /* @@ -1086,8 +1086,6 @@ uvm_page_unbusy(struct vm_page **pgs, int npgs) uvm_pagefree(pg); uvm_unlock_pageq(); } else { - atomic_clearbits_int(&pg->pg_flags, PG_BUSY); - UVM_PAGE_OWN(pg, NULL); rw_enter(pg->uanon->an_lock, RW_WRITE); uvm_anon_release(pg->uanon); } -- 2.20.1