From owner-freebsd-current@FreeBSD.ORG Tue May 1 11:34:57 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7CFC216A400 for ; Tue, 1 May 2007 11:34:57 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 4279213C489 for ; Tue, 1 May 2007 11:34:57 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 59D44208C; Tue, 1 May 2007 13:34:53 +0200 (CEST) X-Spam-Tests: AWL X-Spam-Learn: disabled X-Spam-Score: 0.0/3.0 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on tim.des.no Received: from dwp.des.no (des.no [80.203.243.180]) by smtp.des.no (Postfix) with ESMTP id C1B462089; Tue, 1 May 2007 13:34:52 +0200 (CEST) Received: by dwp.des.no (Postfix, from userid 1001) id 943C7507A; Tue, 1 May 2007 13:34:52 +0200 (CEST) From: des@des.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) To: Kostik Belousov References: <200704281128.44077.shoesoft@gmx.net> <20070428115503.GM2441@deviant.kiev.zoral.com.ua> <86y7k8rgc4.fsf@dwp.des.no> <86tzuwrfui.fsf@dwp.des.no> <20070501111902.GA2441@deviant.kiev.zoral.com.ua> Date: Tue, 01 May 2007 13:34:52 +0200 In-Reply-To: <20070501111902.GA2441@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Tue, 1 May 2007 14:19:02 +0300") Message-ID: <864pmwbwv7.fsf@dwp.des.no> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Cc: freebsd-current@freebsd.org, Stefan Ehmann Subject: Re: strace causes panic: sleeping thread X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 May 2007 11:34:57 -0000 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Kostik Belousov writes: > The procfs PIOCWAIT/PIOCWAIT32 ioctls drop the p_mtx for > sleep. Could it be that p being freed/reused meantime ? So it should be held while the lock is dropped. It is still a procfs issue (and one that was present, although benign, before I removed Giant from pseudofs). Please try this updated 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 11:30:22 -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) @@ -124,8 +127,10 @@ case PIOCWAIT: while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) { /* sleep until p stops */ + _PHOLD(p); error = msleep(&p->p_stype, &p->p_mtx, PWAIT|PCATCH, "pioctl", 0); + _PRELE(p); if (error != 0) break; } @@ -142,8 +147,10 @@ case PIOCWAIT32: while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) { /* sleep until p stops */ + _PHOLD(p); error = msleep(&p->p_stype, &p->p_mtx, PWAIT|PCATCH, "pioctl", 0); + _PRELE(p); if (error != 0) break; } @@ -193,7 +200,6 @@ default: error = (ENOTTY); } - PROC_UNLOCK(p); return (error); } --=-=-=--