Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/filemon/filemon_wrapper.c
Show All 26 Lines | |||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/eventhandler.h> | #include <sys/eventhandler.h> | ||||
#include <sys/filedesc.h> | #include <sys/filedesc.h> | ||||
#include <sys/imgact.h> | #include <sys/imgact.h> | ||||
#include <sys/priv.h> | |||||
#include <sys/sx.h> | #include <sys/sx.h> | ||||
#include <sys/vnode.h> | #include <sys/vnode.h> | ||||
#include "opt_compat.h" | #include "opt_compat.h" | ||||
static eventhandler_tag filemon_exec_tag; | static eventhandler_tag filemon_exec_tag; | ||||
static eventhandler_tag filemon_exit_tag; | static eventhandler_tag filemon_exit_tag; | ||||
static eventhandler_tag filemon_fork_tag; | static eventhandler_tag filemon_fork_tag; | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | filemon_event_process_exec(void *arg __unused, struct proc *p, | ||||
if ((filemon = filemon_proc_get(p)) != NULL) { | if ((filemon = filemon_proc_get(p)) != NULL) { | ||||
len = snprintf(filemon->msgbufr, | len = snprintf(filemon->msgbufr, | ||||
sizeof(filemon->msgbufr), "E %d %s\n", | sizeof(filemon->msgbufr), "E %d %s\n", | ||||
p->p_pid, | p->p_pid, | ||||
imgp->execpath != NULL ? imgp->execpath : "<unknown>"); | imgp->execpath != NULL ? imgp->execpath : "<unknown>"); | ||||
filemon_output(filemon, filemon->msgbufr, len); | filemon_output(filemon, filemon->msgbufr, len); | ||||
/* If the credentials changed then cease tracing. */ | |||||
if (imgp->newcred != NULL && | |||||
imgp->credential_setid && | |||||
priv_check_cred(filemon->cred, | |||||
PRIV_DEBUG_DIFFCRED, 0) != 0) { | |||||
/* | |||||
* It may have changed to NULL already, but | |||||
* will not be re-attached by anything else. | |||||
*/ | |||||
if (p->p_filemon != NULL) { | |||||
KASSERT(p->p_filemon == filemon, | |||||
("%s: proc %p didn't have expected" | |||||
" filemon %p", __func__, p, filemon)); | |||||
filemon_proc_drop(p); | |||||
} | |||||
} | |||||
filemon_drop(filemon); | filemon_drop(filemon); | ||||
} | } | ||||
} | } | ||||
static void | static void | ||||
_filemon_wrapper_openat(struct thread *td, char *upath, int flags, int fd) | _filemon_wrapper_openat(struct thread *td, char *upath, int flags, int fd) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 347 Lines • Show Last 20 Lines |