Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jul 2005 10:59:19 -0400
From:      John Baldwin <jhb@FreeBSD.org>
To:        ia64@FreeBSD.org
Subject:   Lock Giant around freebsd32_mmap hack
Message-ID:  <200507081059.19769.jhb@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Can someone test this patch or at least sign off on it?  Thanks!

--- //depot/projects/smpng/sys/compat/freebsd32/freebsd32_misc.c	2005/07/07 
19:45:15
+++ //depot/user/jhb/proc/compat/freebsd32/freebsd32_misc.c	2005/07/07 
21:21:45
@@ -397,6 +396,7 @@
 		start = addr;
 		end = addr + len;
 
+		mtx_lock(&Giant);
 		if (start != trunc_page(start)) {
 			error = freebsd32_mmap_partial(td, start,
 						       round_page(start), prot,
@@ -427,11 +427,14 @@
 			prot |= VM_PROT_WRITE;
 			map = &td->td_proc->p_vmspace->vm_map;
 			rv = vm_map_remove(map, start, end);
-			if (rv != KERN_SUCCESS)
+			if (rv != KERN_SUCCESS) {
+				mtx_unlock(&Giant);
 				return (EINVAL);
+			}
 			rv = vm_map_find(map, 0, 0,
 					 &start, end - start, FALSE,
 					 prot, VM_PROT_ALL, 0);
+			mtx_unlock(&Giant);
 			if (rv != KERN_SUCCESS)
 				return (EINVAL);
 			r.fd = fd;
@@ -445,6 +448,7 @@
 			td->td_retval[0] = addr;
 			return (0);
 		}
+		mtx_unlock(&Giant);
 		if (end == start) {
 			/*
 			 * After dealing with the ragged ends, there

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507081059.19769.jhb>