Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Mar 2015 20:15:50 +0000 (UTC)
From:      Randall Stewart <rrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r279894 - head/sys/dev/hwpmc
Message-ID:  <201503112015.t2BKFo3D003421@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <sys/param.h>
 #if (__FreeBSD_version >= 1100000)
 #include <sys/capsicum.h>
+#else
+#include <sys/capability.h>
 #endif
 #include <sys/file.h>
 #include <sys/kernel.h>
@@ -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,



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