Date: Tue, 01 May 2007 12:35:49 +0200 From: des@des.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) To: Kostik Belousov <kostikbel@gmail.com> Cc: freebsd-current@freebsd.org, Stefan Ehmann <shoesoft@gmx.net> Subject: Re: strace causes panic: sleeping thread Message-ID: <86tzuwrfui.fsf@dwp.des.no> In-Reply-To: <86y7k8rgc4.fsf@dwp.des.no> (Dag-Erling =?iso-8859-1?Q?Sm=F8r?= =?iso-8859-1?Q?grav's?= message of "Tue, 01 May 2007 12:25:15 %2B0200") References: <200704281128.44077.shoesoft@gmx.net> <20070428115503.GM2441@deviant.kiev.zoral.com.ua> <86y7k8rgc4.fsf@dwp.des.no>
next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable des@des.no (Dag-Erling Sm=F8rgrav) writes: > procfs_ioctl() needs the process to be locked; pn_ioctl() verifies > that this is the case before calling it. The correct fix is not to > unlock the process before calling procfs_ioctl(), but to remove the > latter's redundant PROC_LOCK() / PROC_UNLOCK() calls. See attached patch. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=procfs.diff Index: sys/fs/procfs/procfs_ioctl.c =================================================================== RCS file: /home/ncvs/src/sys/fs/procfs/procfs_ioctl.c,v retrieving revision 1.16 diff -u -r1.16 procfs_ioctl.c --- sys/fs/procfs/procfs_ioctl.c 19 Feb 2007 13:04:25 -0000 1.16 +++ sys/fs/procfs/procfs_ioctl.c 1 May 2007 10:26:17 -0000 @@ -70,7 +70,10 @@ int ival; #endif - PROC_LOCK(p); + KASSERT(p != NULL, + ("%s() called without a process", __func__)); + PROC_LOCK_ASSERT(p, MA_OWNED); + error = 0; switch (cmd) { #if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) @@ -193,7 +196,6 @@ default: error = (ENOTTY); } - PROC_UNLOCK(p); return (error); } --=-=-=--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86tzuwrfui.fsf>