Index | Thread | Search

From:
Mark Kettenis <mark.kettenis@xs4all.nl>
Subject:
Re: dosetrlimit() w/o KERNEL_LOCK()
To:
Martin Pieuchot <mpi@grenadille.net>
Cc:
tech@openbsd.org
Date:
Fri, 15 Aug 2025 11:45:24 +0200

Download raw body.

Thread
> Date: Fri, 15 Aug 2025 11:35:12 +0200
> From: Martin Pieuchot <mpi@grenadille.net>
> 
> uvm_map_protect() grabs the vm_map lock and do not require the
> KERNEL_LOCK().
> 
> ok?

ok kettenis@

> Index: kern/kern_resource.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/kern_resource.c,v
> diff -u -p -r1.95 kern_resource.c
> --- kern/kern_resource.c	31 May 2025 12:40:33 -0000	1.95
> +++ kern/kern_resource.c	15 Aug 2025 07:58:14 -0000
> @@ -328,10 +328,8 @@ dosetrlimit(struct proc *p, u_int which,
>  			}
>  			addr = trunc_page(addr);
>  			size = round_page(size);
> -			KERNEL_LOCK();
>  			(void) uvm_map_protect(&vm->vm_map, addr,
>  			    addr+size, prot, UVM_ET_STACK, FALSE, FALSE);
> -			KERNEL_UNLOCK();
>  		}
>  	}
>  
> 
> 
>