From owner-p4-projects@FreeBSD.ORG Tue Jun 9 18:05:19 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 28FFE10656C0; Tue, 9 Jun 2009 18:05:19 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D541B10656B7 for ; Tue, 9 Jun 2009 18:05:18 +0000 (UTC) (envelope-from marinosi@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id C2F778FC1E for ; Tue, 9 Jun 2009 18:05:18 +0000 (UTC) (envelope-from marinosi@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n59I5HgM057149 for ; Tue, 9 Jun 2009 18:05:17 GMT (envelope-from marinosi@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n59I5F4I057147 for perforce@freebsd.org; Tue, 9 Jun 2009 18:05:15 GMT (envelope-from marinosi@FreeBSD.org) Date: Tue, 9 Jun 2009 18:05:15 GMT Message-Id: <200906091805.n59I5F4I057147@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marinosi@FreeBSD.org using -f From: Ilias Marinos To: Perforce Change Reviews Cc: Subject: PERFORCE change 163920 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jun 2009 18:05:20 -0000 http://perforce.freebsd.org/chv.cgi?CH=163920 Change 163920 by marinosi@marinosi_redrum on 2009/06/09 18:04:49 - Fix a memory related bug Affected files ... .. //depot/projects/soc2009/marinosi_appaudit/src/sys/security/audit/audit.c#3 edit .. //depot/projects/soc2009/marinosi_appaudit/src/sys/security/audit/audit_private.h#3 edit Differences ... ==== //depot/projects/soc2009/marinosi_appaudit/src/sys/security/audit/audit.c#3 (text) ==== @@ -79,13 +79,13 @@ MALLOC_DEFINE(M_AUDITDATA, "audit_data", "Audit data storage"); MALLOC_DEFINE(M_AUDITPATH, "audit_path", "Audit path storage"); MALLOC_DEFINE(M_AUDITTEXT, "audit_text", "Audit text storage"); +MALLOC_DEFINE(M_AUDITSLICE, "audit_slice", "Audit slice storage"); SYSCTL_NODE(_security, OID_AUTO, audit, CTLFLAG_RW, 0, "TrustedBSD audit controls"); +struct audit_slice *audit_base_slice = NULL; -struct audit_slice base_slice; -struct audit_slice *audit_base_slice = &base_slice; /* * Kernel audit information. This will store the current audit address * or host information that the kernel will use when it's generating @@ -193,7 +193,12 @@ audit_init(void *arg) { + if ( audit_base_slice == NULL ) + audit_base_slice = malloc(sizeof(*audit_base_slice), + M_AUDITSLICE, M_WAITOK | M_ZERO); + struct audit_slice *as = (struct audit_slice *) arg; + as = audit_base_slice; as->audit_enabled = 0; as->audit_suspended = 0; @@ -245,7 +250,7 @@ } /* Init the base slice */ -SYSINIT(audit_init, SI_SUB_AUDIT, SI_ORDER_FIRST, audit_init, &audit_base_slice); +SYSINIT(audit_init, SI_SUB_AUDIT, SI_ORDER_FIRST, audit_init, NULL); /* * Drain the audit queue and close the log at shutdown. Note that this can ==== //depot/projects/soc2009/marinosi_appaudit/src/sys/security/audit/audit_private.h#3 (text) ==== @@ -50,6 +50,7 @@ MALLOC_DECLARE(M_AUDITDATA); MALLOC_DECLARE(M_AUDITPATH); MALLOC_DECLARE(M_AUDITTEXT); +MALLOC_DECLARE(M_AUDITSLICE); #endif /* @@ -283,17 +284,6 @@ #define AU_PRS_FAILURE 2 #define AU_PRS_BOTH (AU_PRS_SUCCESS|AU_PRS_FAILURE) -/* - * Data structures relating to the kernel audit queue. Ideally, these might - * be abstracted so that only accessor methods are exposed. - */ -extern struct mtx audit_mtx; -extern struct cv audit_watermark_cv; -extern struct cv audit_worker_cv; -extern struct kaudit_queue audit_q; -extern int audit_q_len; -extern int audit_pre_q_len; -extern int audit_in_failure; /* * Flags to use on audit files when opening and closing.