[comp.bugs.4bsd] 4.3BSD fodkluster

jtkohl@athena.mit.edu (John T Kohl) (06/09/87)

Index: sys/sys/vm_page.c, 4.3BSD and derivatives, including Wisconsin
	4.3+NFS

Description:
	When paging in a new process, it is possible that fodkluster()
	is called as part of pagein().  In this case, it tries to
	decrement an unsigned which is set to zero, and check if it is
	less than some value. This produces a panic shortly thereafter.

Fix:
	For binary sites, you can patch the global nofodklust to be
	non-zero in a running system (it's BSS, so you can't patch the
	kernel).  Source sites cann apply this patch (your line numbers
	will almost certainly be different):

*** /tmp/,RCSt1020091	Tue Jun  9 09:34:09 1987
--- vm_page.c	Fri Jun  5 11:18:18 1987
***************
*** 1271,1276 ****
--- 1271,1281 ----
  	bn = *pbn;
  	v = v0;
  	for (klsize = 1; klsize < KLMAX; klsize++) {
+ 		/* since v is unsigned, we must never decrement it below
+ 		   zero or the v < vmin test will fail and we can
+ 		   end up calling vtod with an invalid v */
+ 		if (v < CLSIZE)
+ 			break;
  		v -= CLSIZE;
  		if (v < vmin)
  			break;

----
John Kohl
MIT/Project Athena