From 551a78956cea6f3f5b52f3377466dac3fa111926 Mon Sep 17 00:00:00 2001 From: Rui Paulo Date: Fri, 1 Aug 2014 23:29:04 +0000 Subject: [PATCH] In the shm_open() and shm_unlink() syscalls, export the path to KTR. MFC after: 1 week --- sys/kern/uipc_shm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index 474c243c89f..773a97ca02c 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include "opt_capsicum.h" +#include "opt_ktrace.h" #include #include @@ -53,6 +54,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include +#include #include #include #include @@ -727,7 +731,10 @@ sys_shm_open(struct thread *td, struct shm_open_args *uap) } else { path = malloc(MAXPATHLEN, M_SHMFD, M_WAITOK); error = copyinstr(uap->path, path, MAXPATHLEN, NULL); - +#ifdef KTRACE + if (error == 0 && KTRPOINT(curthread, KTR_NAMEI)) + ktrnamei(path); +#endif /* Require paths to start with a '/' character. */ if (error == 0 && path[0] != '/') error = EINVAL; @@ -825,7 +832,10 @@ sys_shm_unlink(struct thread *td, struct shm_unlink_args *uap) free(path, M_TEMP); return (error); } - +#ifdef KTRACE + if (KTRPOINT(curthread, KTR_NAMEI)) + ktrnamei(path); +#endif fnv = fnv_32_str(path, FNV1_32_INIT); sx_xlock(&shm_dict_lock); error = shm_remove(path, fnv, td->td_ucred);