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)
This commit is contained in:
Randall Stewart 2015-03-11 20:15:49 +00:00
parent 69a088631e
commit de8d8ca4c8

View File

@ -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, struct pmc_owner *po, int logfd)
{
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, struct pmc_owner *po, int logfd)
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,