From: Matthew Dillon Date: Tue, 25 May 2010 22:13:29 +0000 (-0700) Subject: kernel - Fix panic in setrlimit() when changing the stack limit X-Git-Tag: v2.9.0~981 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/e81fcb2c8ba8c4ad138c6a9dc8c1edeb22f32e27 kernel - Fix panic in setrlimit() when changing the stack limit * setrlimit() has to make a VM call with the MP lock held when changing the stack limit, and was not properly obtaining the MP lock. --- diff --git a/sys/kern/kern_plimit.c b/sys/kern/kern_plimit.c index c882b7e7d8..d799578eae 100644 --- a/sys/kern/kern_plimit.c +++ b/sys/kern/kern_plimit.c @@ -84,6 +84,7 @@ #include #include +#include static void plimit_copy(struct plimit *olimit, struct plimit *nlimit); @@ -400,8 +401,10 @@ kern_setrlimit(u_int which, struct rlimit *limp) spin_unlock_rd(&limit->p_spin); addr = trunc_page(addr); size = round_page(size); - (void) vm_map_protect(&p->p_vmspace->vm_map, - addr, addr+size, prot, FALSE); + get_mplock(); + vm_map_protect(&p->p_vmspace->vm_map, + addr, addr+size, prot, FALSE); + rel_mplock(); } else { spin_unlock_rd(&limit->p_spin); }