aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index cf067527237e..03268365891e 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -29,6 +29,7 @@
#include <sys/cdefs.h>
#include "opt_capsicum.h"
#include "opt_hwpmc_hooks.h"
+#include "opt_hwt_hooks.h"
#include "opt_ktrace.h"
#include "opt_vm.h"
@@ -90,6 +91,10 @@
#include <sys/pmckern.h>
#endif
+#ifdef HWT_HOOKS
+#include <dev/hwt/hwt_hook.h>
+#endif
+
#include <security/audit/audit.h>
#include <security/mac/mac_framework.h>
@@ -936,6 +941,20 @@ interpret:
}
#endif
+#ifdef HWT_HOOKS
+ if ((td->td_proc->p_flag2 & P2_HWT) != 0) {
+ struct hwt_record_entry ent;
+
+ VOP_UNLOCK(imgp->vp);
+ ent.fullpath = imgp->execpath;
+ ent.addr = imgp->et_dyn_addr;
+ ent.baseaddr = imgp->reloc_base;
+ ent.record_type = HWT_RECORD_EXECUTABLE;
+ HWT_CALL_HOOK(td, HWT_EXEC, &ent);
+ vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
+ }
+#endif
+
/* Set values passed into the program in registers. */
(*p->p_sysent->sv_setregs)(td, imgp, stack_base);