From owner-svn-src-head@FreeBSD.ORG Wed Feb 20 17:55:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D71CCD03; Wed, 20 Feb 2013 17:55:17 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B0F337CE; Wed, 20 Feb 2013 17:55:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1KHtHGF068795; Wed, 20 Feb 2013 17:55:17 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1KHtHA6068794; Wed, 20 Feb 2013 17:55:17 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201302201755.r1KHtHA6068794@svn.freebsd.org> From: "Justin T. Gibbs" Date: Wed, 20 Feb 2013 17:55:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247049 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2013 17:55:17 -0000 Author: gibbs Date: Wed Feb 20 17:55:17 2013 New Revision: 247049 URL: http://svnweb.freebsd.org/changeset/base/247049 Log: Avoid panic when tearing down the DTrace pid provider for a process that has crashed. sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c: In fasttrap_pid_disable(), we cannot PHOLD the proc structure for a process that no longer exists, but we still have other, fasttrap specific, state that must be cleaned up for probes that existed in the dead process. Instead of returning early if the process related to our probes isn't found, conditionalize the locking and carry on with a NULL proc pointer. The rest of the fasttrap code already understands that a NULL proc is possible and does the right things in this case. Sponsored by: Spectra Logic Corporation Reviewed by: rpaulo, gnn MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Wed Feb 20 17:46:38 2013 (r247048) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Wed Feb 20 17:55:17 2013 (r247049) @@ -1124,14 +1124,12 @@ fasttrap_pid_disable(void *arg, dtrace_i * provider lock as a point of mutual exclusion to prevent other * DTrace consumers from disabling this probe. */ - if ((p = pfind(probe->ftp_pid)) == NULL) { - mutex_exit(&provider->ftp_mtx); - return; - } + if ((p = pfind(probe->ftp_pid)) != NULL) { #ifdef __FreeBSD__ - _PHOLD(p); - PROC_UNLOCK(p); + _PHOLD(p); + PROC_UNLOCK(p); #endif + } /* * Disable all the associated tracepoints (for fully enabled probes). @@ -1168,7 +1166,8 @@ fasttrap_pid_disable(void *arg, dtrace_i fasttrap_pid_cleanup(); #ifdef __FreeBSD__ - PRELE(p); + if (p != NULL) + PRELE(p); #endif if (!probe->ftp_enabled) return;