Subject: Re: infinite loop in uvm_map_clean() ?
To: None <k-abe@cs.utah.edu>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 01/12/2001 20:50:07
hi,

the case you're checking for is already caught by this bit:

		if (end > current->end && (current->next == &map->header ||
		    current->end != current->next->start)) {
			vm_map_unlock_read(map);
			return (KERN_INVALID_ADDRESS);
		}

-Chuck


On Fri, Jan 12, 2001 at 08:13:30PM -0700, k-abe@cs.utah.edu wrote:
> Hi,
> 
> It seems that uvm_map_clean() might fall into infinite loop.
> I'm not sure whether this bug shows up in the NetBSD world because
> I'm just playing with UVM..
> 
> A fix is something like:
> 
> *** /home/k-abe/NetBSD/syssrc/sys/uvm/uvm_map.c	Mon Nov 27 01:40:03 2000
> --- ../netbsd/src/sys/uvm/uvm_map.c	Fri Jan 12 18:16:58 2001
> ***************
> *** 2474,2480 ****
>   	 * Make a first pass to check for holes.
>   	 */
>   
> ! 	for (current = entry; current->start < end; current = current->next) {
>   		if (UVM_ET_ISSUBMAP(current)) {
>   			vm_map_unlock_read(map);
>   			return (KERN_INVALID_ARGUMENT);
> --- 2481,2491 ----
>   	 * Make a first pass to check for holes.
>   	 */
>   
> ! 	for (current = entry; 
> ! #ifdef OSKIT	     
> ! 	     (current != &map->header) &&
> ! #endif
> ! 		 current->start < end; current = current->next) {
>   		if (UVM_ET_ISSUBMAP(current)) {
>   			vm_map_unlock_read(map);
>   			return (KERN_INVALID_ARGUMENT);
> ***************
> *** 2488,2494 ****
>   
>   	error = KERN_SUCCESS;
>   
> ! 	for (current = entry; current->start < end; current = current->next) {
>   		amap = current->aref.ar_amap;	/* top layer */
>   		uobj = current->object.uvm_obj;	/* bottom layer */
>   		KASSERT(start >= current->start);
> --- 2499,2509 ----
>   
>   	error = KERN_SUCCESS;
>   
> ! 	for (current = entry; 
> ! #ifdef OSKIT	     
> ! 	     (current != &map->header) &&
> ! #endif
> ! 		 current->start < end; current = current->next) {
>   		amap = current->aref.ar_amap;	/* top layer */
>   		uobj = current->object.uvm_obj;	/* bottom layer */
>   		KASSERT(start >= current->start);
> 
> -- 
> Kota Abe
> Dept. of Computer Science, Univ. of Utah.
> Media Center, Osaka City Univ.