PERFORCE change 163920 for review

Ilias Marinos marinosi at FreeBSD.org
Tue Jun 9 18:05:20 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=163920

Change 163920 by marinosi at 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.


More information about the p4-projects mailing list