Log corruption

David Woodhouse dwmw2 at infradead.org
Tue May 10 17:30:53 UTC 2005


On Tue, 2005-05-10 at 10:23 -0700, Chris Wright wrote:
> I had intended on augmenting audit_expand to take a len as a hint.
> But had planned that as cleanups after core changes are done.  I'll
> get to that today, and push out all the little cleanup bits I have
> this evening.

Already in the RPM...

--- linux-2.6.9/kernel/audit.c.p20038	2005-05-10 13:38:40.000000000 +0100
+++ linux-2.6.9/kernel/audit.c	2005-05-10 13:42:31.000000000 +0100
@@ -687,10 +703,10 @@
  * Returns 0 (no space) on failed expansion, or available space if
  * successful.
  */
-static inline int audit_expand(struct audit_buffer *ab)
+static inline int audit_expand(struct audit_buffer *ab, int extra)
 {
 	struct sk_buff *skb = ab->skb;
-	int ret = pskb_expand_head(skb, skb_headroom(skb), AUDIT_BUFSIZ,
+	int ret = pskb_expand_head(skb, skb_headroom(skb), extra,
 				   GFP_ATOMIC);
 	if (ret < 0) {
 		audit_log_lost("out of memory in audit_expand");
@@ -716,7 +732,7 @@
 	skb = ab->skb;
 	avail = skb_tailroom(skb);
 	if (avail == 0) {
-		avail = audit_expand(ab);
+		avail = audit_expand(ab, AUDIT_BUFSIZ);
 		if (!avail)
 			goto out;
 	}
@@ -725,7 +741,7 @@
 		/* The printk buffer is 1024 bytes long, so if we get
 		 * here and AUDIT_BUFSIZ is at least 1024, then we can
 		 * log everything that printk could have logged. */
-		avail = audit_expand(ab);
+		avail = audit_expand(ab, 1+len-avail);
 		if (!avail)
 			goto out;
 		len = vsnprintf(skb->tail, avail, fmt, args);


-- 
dwmw2




More information about the Linux-audit mailing list