From owner-p4-projects@FreeBSD.ORG Wed Jul 28 00:21:56 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 65D9F16A4DC; Wed, 28 Jul 2004 00:21:56 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3817E16A4D5 for ; Wed, 28 Jul 2004 00:21:56 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1585743D39 for ; Wed, 28 Jul 2004 00:21:56 +0000 (GMT) (envelope-from wsalamon@computer.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i6S0Lkh3066257 for ; Wed, 28 Jul 2004 00:21:46 GMT (envelope-from wsalamon@computer.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i6S0LkdJ066254 for perforce@freebsd.org; Wed, 28 Jul 2004 00:21:46 GMT (envelope-from wsalamon@computer.org) Date: Wed, 28 Jul 2004 00:21:46 GMT Message-Id: <200407280021.i6S0LkdJ066254@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to wsalamon@computer.org using -f From: Wayne Salamon To: Perforce Change Reviews Subject: PERFORCE change 58336 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jul 2004 00:21:57 -0000 http://perforce.freebsd.org/chv.cgi?CH=58336 Change 58336 by wsalamon@wsalamon_epi on 2004/07/28 00:21:45 Add calls to allocate, clone, and free the audit structure for the proc. Clean up audit_kernel.h, removing Darwin-specific remnants, and updating the AUDIT_SYSCALL_EXIT macro. Affected files ... .. //depot/projects/trustedbsd/audit3/sys/bsm/audit_kernel.h#3 edit .. //depot/projects/trustedbsd/audit3/sys/kern/init_main.c#2 edit .. //depot/projects/trustedbsd/audit3/sys/kern/kern_exit.c#2 edit .. //depot/projects/trustedbsd/audit3/sys/kern/kern_fork.c#2 edit Differences ... ==== //depot/projects/trustedbsd/audit3/sys/bsm/audit_kernel.h#3 (text+ko) ==== @@ -343,30 +343,13 @@ * auditing is enabled, or we have a audit record on the thread. It is * possible that an audit record was begun before auditing was turned off. */ -#define AUDIT_SYSCALL_EXIT(error, proc, uthread) do { \ - if (audit_enabled | (uthread->uu_ar != NULL)) { \ - audit_syscall_exit(error, proc, uthread); \ +#define AUDIT_SYSCALL_EXIT(error, td) do { \ + if (audit_enabled | (td->td_ar != NULL)) { \ + audit_syscall_exit(error, td); \ } \ } while (0) /* - * Wrap the audit_mach_syscall_enter() and audit_mach_syscall_exit() - * functions in a manner similar to other system call enter/exit functions. - */ -#define AUDIT_MACH_SYSCALL_ENTER(args...) do { \ - if (audit_enabled) { \ - audit_mach_syscall_enter(args); \ - } \ - } while (0) - -#define AUDIT_MACH_SYSCALL_EXIT(retval) do { \ - struct uthread *uthread = get_bsdthread_info(current_act()); \ - if (audit_enabled | (uthread->uu_ar != NULL)) { \ - audit_mach_syscall_exit(retval, uthread); \ - } \ - } while (0) - -/* * A Macro to wrap the audit_sysclose() function. */ #define AUDIT_SYSCLOSE(args...) do { \ @@ -378,13 +361,7 @@ #define AUDIT_SYSCALL_ENTER(args...) do { \ } while (0) -#define AUDIT_SYSCALL_EXIT(error, proc, uthread) do { \ - } while (0) - -#define AUDIT_MACH_SYSCALL_ENTER(args...) do { \ - } while (0) - -#define AUDIT_MACH_SYSCALL_EXIT(retval) do { \ +#define AUDIT_SYSCALL_EXIT(error, td) do { \ } while (0) #define AUDIT_SYSCLOSE(op, args...) do { \ ==== //depot/projects/trustedbsd/audit3/sys/kern/init_main.c#2 (text+ko) ==== @@ -76,6 +76,8 @@ #include +#include + #include #include #include @@ -407,6 +409,10 @@ p->p_ucred->cr_uidinfo = uifind(0); p->p_ucred->cr_ruidinfo = uifind(0); p->p_ucred->cr_prison = NULL; /* Don't jail it. */ +#ifdef AUDIT + audit_proc_alloc(p); + audit_proc_kproc0(p); +#endif #ifdef MAC mac_create_proc0(p->p_ucred); #endif @@ -705,6 +711,9 @@ #ifdef MAC mac_create_proc1(newcred); #endif +#ifdef AUDIT + audit_proc_init(initproc); +#endif initproc->p_ucred = newcred; PROC_UNLOCK(initproc); crfree(oldcred); ==== //depot/projects/trustedbsd/audit3/sys/kern/kern_exit.c#2 (text+ko) ==== @@ -69,6 +69,8 @@ #include #endif +#include + #include #include #include @@ -178,6 +180,10 @@ p->p_flag |= P_WEXIT; PROC_UNLOCK(p); +#ifdef AUDIT + AUDIT_SYSCALL_EXIT(0, td); +#endif + /* Are we a task leader? */ if (p == p->p_leader) { mtx_lock(&ppeers_lock); @@ -702,6 +708,9 @@ #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!")); uma_zfree(proc_zone, p); ==== //depot/projects/trustedbsd/audit3/sys/kern/kern_fork.c#2 (text+ko) ==== @@ -65,6 +65,8 @@ #include #include +#include + #include #include #include @@ -287,6 +289,9 @@ #ifdef MAC mac_init_proc(newproc); #endif +#ifdef AUDIT + audit_proc_alloc(newproc); +#endif /* We have to lock the process tree while we look for a pid. */ sx_slock(&proctree_lock); @@ -520,7 +525,9 @@ 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) { @@ -758,6 +765,9 @@ #ifdef MAC mac_destroy_proc(newproc); #endif +#ifdef AUDIT + audit_proc_free(newproc); +#endif uma_zfree(proc_zone, newproc); if (p1->p_flag & P_SA) { PROC_LOCK(p1);