Subject: Re: CVS commit: src/sys/uvm
To: enami tsugutomo <enami@sm.sony.co.jp>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: source-changes
Date: 03/04/2003 17:07:00
--LQksG6bCIzRHxTLp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Mar 04, 2003 at 04:43:37PM +0900, enami tsugutomo wrote:

 > I'm afraid null pointer is dereferenced when accessing something like
 > uobj->pgops->pgo_put (we test if pgo_put is null or not, but doesn't
 > test if pgops is null).

Ok, I think the easiest thing to do is just make sure the page
never ends up on a paging queue.  I'll check in the following
patch.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>

--LQksG6bCIzRHxTLp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=uvm-patch

Index: uvm_loan.c
===================================================================
RCS file: /cvsroot/src/sys/uvm/uvm_loan.c,v
retrieving revision 1.40
diff -c -r1.40 uvm_loan.c
*** uvm_loan.c	2003/03/04 06:18:54	1.40
--- uvm_loan.c	2003/03/05 01:01:18
***************
*** 671,676 ****
--- 671,684 ----
  		pg->flags &= ~(PG_WANTED|PG_BUSY|PG_FAKE);
  		pg->flags |= PG_RDONLY;
  		UVM_PAGE_OWN(pg, NULL);
+ 
+ 		/*
+ 		 * we never want this page to be on a paging queue,
+ 		 * so wire it.
+ 		 */
+ 		uvm_lock_pageq();
+ 		uvm_pagewire(pg);
+ 		uvm_unlock_pageq();
  	}
  
  	if ((flags & UVM_LOAN_TOANON) == 0) {	/* loaning to kernel-page */
***************
*** 715,721 ****
  	pg->uanon = anon;
  	uvm_lock_pageq();
  	pg->loan_count++;
- 	uvm_pageactivate(pg);
  	uvm_unlock_pageq();
  	simple_unlock(&uvm_loanzero_object.vmobjlock);
  	**output = anon;
--- 723,728 ----

--LQksG6bCIzRHxTLp--