Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 Jun 2001 21:39:59 +0900
From:      Seigo Tanimura <tanimura@r.dl.itc.u-tokyo.ac.jp>
To:        D.Rock@t-online.de
Cc:        Alfred Perlstein <bright@rush.net>, current@freebsd.org, Seigo Tanimura <tanimura@r.dl.itc.u-tokyo.ac.jp>
Subject:   Re: panic in procfs code
Message-ID:  <200106051240.f55CdxD05625@rina.r.dl.itc.u-tokyo.ac.jp>
In-Reply-To: In your message of "Tue, 05 Jun 2001 12:21:46 %2B0200" <3B1CB2BA.32057B4E@t-online.de>
References:  <3B1CB2BA.32057B4E@t-online.de>

next in thread | previous in thread | raw e-mail | index | archive | help
--Multipart_Tue_Jun__5_21:39:59_2001-1
Content-Type: text/plain; charset=US-ASCII

On Tue, 05 Jun 2001 12:21:46 +0200,
  Daniel Rock <D.Rock@t-online.de> said:

Daniel> Hi,
Daniel> I just noticed: Doing a simple "cat /proc/$$/map" panics the system:
(snip)
Daniel> _mtx_unlock_sleep(c049c9c0,0,c03b01a0,f2) at _mtx_unlock_sleep+0xa3
Daniel> lockmgr(c55fadb0,10001,c049c9c0,c55f4100) at lockmgr+0x9d
Daniel> procfs_domap(c55f4100,c55f4320,c0c90da0,c6eefefc,c0cc3180) at
Daniel> procfs_domap+0x88

Lock and unlock of vm_mtx around vm_map_(un)lock_read() in
procfs_domap() are missing. The attached patch should fix the bug.


--Multipart_Tue_Jun__5_21:39:59_2001-1
Content-Type: text/plain; type=patch; charset=US-ASCII
Content-Disposition: attachment; filename="procfs_map.c.diff"
Content-Transfer-Encoding: 7bit

Index: fs/procfs/procfs_map.c
===================================================================
RCS file: /home/naklab/tanimura/rina2/CVS/FreeBSD/sys/fs/procfs/procfs_map.c,v
retrieving revision 1.1.1.1.8.1
diff -u -r1.1.1.1.8.1 procfs_map.c
--- fs/procfs/procfs_map.c	2001/05/27 02:39:08	1.1.1.1.8.1
+++ fs/procfs/procfs_map.c	2001/06/05 12:16:06
@@ -87,6 +87,8 @@
 	if (uio->uio_offset != 0)
 		return (0);
 	
+	mtx_lock(&vm_mtx);
+
 	error = 0;
 	if (map != &curproc->p_vmspace->vm_map)
 		vm_map_lock_read(map);
@@ -169,12 +171,17 @@
 			error = EFBIG;
 			break;
 		}
+		mtx_unlock(&vm_mtx);
 		error = uiomove(mebuffer, len, uio);
+		mtx_lock(&vm_mtx);
 		if (error)
 			break;
 	}
 	if (map != &curproc->p_vmspace->vm_map)
 		vm_map_unlock_read(map);
+	
+	mtx_unlock(&vm_mtx);
+
 	return error;
 }
 

--Multipart_Tue_Jun__5_21:39:59_2001-1
Content-Type: text/plain; charset=US-ASCII


-- 
Seigo Tanimura <tanimura@r.dl.itc.u-tokyo.ac.jp> <tanimura@FreeBSD.org>

--Multipart_Tue_Jun__5_21:39:59_2001-1--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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