From owner-svn-src-all@FreeBSD.ORG Wed Mar 11 20:15:50 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C5907BC3; Wed, 11 Mar 2015 20:15:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0FE6776; Wed, 11 Mar 2015 20:15:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2BKFoxp003422; Wed, 11 Mar 2015 20:15:50 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2BKFo3D003421; Wed, 11 Mar 2015 20:15:50 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201503112015.t2BKFo3D003421@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Wed, 11 Mar 2015 20:15:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279894 - head/sys/dev/hwpmc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Mar 2015 20:15:50 -0000 Author: rrs Date: Wed Mar 11 20:15:49 2015 New Revision: 279894 URL: https://svnweb.freebsd.org/changeset/base/279894 Log: You need to have the capabilities and not skip it if you are not on head.. otherwise the file pointer will be NULL and when you try to do something with it you will crash. Make the #else be the old capabilites, and then remove the erroneous ifdefs for 11. MFC after: 1 week (with the other MFC I was going to do until the panic) Modified: head/sys/dev/hwpmc/hwpmc_logging.c Modified: head/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_logging.c Wed Mar 11 19:04:01 2015 (r279893) +++ head/sys/dev/hwpmc/hwpmc_logging.c Wed Mar 11 20:15:49 2015 (r279894) @@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$"); #include #if (__FreeBSD_version >= 1100000) #include +#else +#include #endif #include #include @@ -570,9 +572,7 @@ pmclog_configure_log(struct pmc_mdep *md { int error; struct proc *p; -#if (__FreeBSD_version >= 1100000) cap_rights_t rights; -#endif /* * As long as it is possible to get a LOR between pmc_sx lock and * proctree/allproc sx locks used for adding a new process, assure @@ -595,12 +595,11 @@ pmclog_configure_log(struct pmc_mdep *md po->po_file)); /* get a reference to the file state */ -#if (__FreeBSD_version >= 1100000) error = fget_write(curthread, logfd, cap_rights_init(&rights, CAP_WRITE), &po->po_file); if (error) goto error; -#endif + /* mark process as owning a log file */ po->po_flags |= PMC_PO_OWNS_LOGFILE; error = kproc_create(pmclog_loop, po, &po->po_kthread,