diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 6147113250f8..e48133548fdb 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -70,6 +70,8 @@ __FBSDID("$FreeBSD$"); #include #endif +#include + #include #include #include @@ -704,6 +706,9 @@ loop: vm_waitproc(p); #ifdef MAC mac_destroy_proc(p); +#endif +#ifdef AUDIT + audit_proc_free(p); #endif KASSERT(FIRST_THREAD_IN_PROC(p), ("kern_wait: no residual thread!")); diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 308b8a4a8399..08b047159133 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -66,6 +66,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -286,6 +288,9 @@ fork1(td, flags, pages, procp) newproc = uma_zalloc(proc_zone, M_WAITOK); #ifdef MAC mac_init_proc(newproc); +#endif +#ifdef AUDIT + audit_proc_alloc(newproc); #endif knlist_init(&newproc->p_klist, &newproc->p_mtx, NULL, NULL, NULL); @@ -507,7 +512,9 @@ again: mtx_unlock_spin(&sched_lock); p2->p_ucred = crhold(td->td_ucred); td2->td_ucred = crhold(p2->p_ucred); /* XXXKSE */ - +#ifdef AUDIT + audit_proc_fork(p1, p2); +#endif pargs_hold(p2->p_args); if (flags & RFSIGSHARE) { @@ -745,6 +752,9 @@ fail: sx_xunlock(&allproc_lock); #ifdef MAC mac_destroy_proc(newproc); +#endif +#ifdef AUDIT + audit_proc_free(newproc); #endif uma_zfree(proc_zone, newproc); if (p1->p_flag & P_HADTHREADS) {