From 51954f2eccac61ea87ac6a26d63efa678e858320 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 2 Mar 2008 12:38:17 -0800 Subject: [PATCH] --- yaml --- r: 86625 b: refs/heads/master c: 038f2f725503b55ab76cfd2645915a85594710fe h: refs/heads/master i: 86623: 18b8436cd799bcd496ad498a86837d4c6538189e v: v3 --- [refs] | 2 +- trunk/kernel/audit.c | 19 ++++++++++++------- trunk/kernel/auditsc.c | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 5bfb30be860c..4c1ccf7ec972 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 855c603d61ede7e2810217f15f0d574b4f29c891 +refs/heads/master: 038f2f725503b55ab76cfd2645915a85594710fe diff --git a/trunk/kernel/audit.c b/trunk/kernel/audit.c index 2eeea9a14240..10c4930c2bbf 100644 --- a/trunk/kernel/audit.c +++ b/trunk/kernel/audit.c @@ -170,7 +170,9 @@ void audit_panic(const char *message) printk(KERN_ERR "audit: %s\n", message); break; case AUDIT_FAIL_PANIC: - panic("audit: %s\n", message); + /* test audit_pid since printk is always losey, why bother? */ + if (audit_pid) + panic("audit: %s\n", message); break; } } @@ -352,6 +354,7 @@ static int kauditd_thread(void *dummy) if (err < 0) { BUG_ON(err != -ECONNREFUSED); /* Shoudn't happen */ printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid); + audit_log_lost("auditd dissapeared\n"); audit_pid = 0; } } else { @@ -1350,17 +1353,19 @@ void audit_log_end(struct audit_buffer *ab) if (!audit_rate_check()) { audit_log_lost("rate limit exceeded"); } else { + struct nlmsghdr *nlh = nlmsg_hdr(ab->skb); if (audit_pid) { - struct nlmsghdr *nlh = nlmsg_hdr(ab->skb); nlh->nlmsg_len = ab->skb->len - NLMSG_SPACE(0); skb_queue_tail(&audit_skb_queue, ab->skb); ab->skb = NULL; wake_up_interruptible(&kauditd_wait); - } else if (printk_ratelimit()) { - struct nlmsghdr *nlh = nlmsg_hdr(ab->skb); - printk(KERN_NOTICE "type=%d %s\n", nlh->nlmsg_type, ab->skb->data + NLMSG_SPACE(0)); - } else { - audit_log_lost("printk limit exceeded\n"); + } else if (nlh->nlmsg_type != AUDIT_EOE) { + if (printk_ratelimit()) { + printk(KERN_NOTICE "type=%d %s\n", + nlh->nlmsg_type, + ab->skb->data + NLMSG_SPACE(0)); + } else + audit_log_lost("printk limit exceeded\n"); } } audit_buffer_free(ab); diff --git a/trunk/kernel/auditsc.c b/trunk/kernel/auditsc.c index 2087d6de67ea..782262e4107d 100644 --- a/trunk/kernel/auditsc.c +++ b/trunk/kernel/auditsc.c @@ -1070,7 +1070,7 @@ static int audit_log_single_execve_arg(struct audit_context *context, * so we can be sure nothing was lost. */ if ((i == 0) && (too_long)) - audit_log_format(*ab, "a%d_len=%ld ", arg_num, + audit_log_format(*ab, "a%d_len=%zu ", arg_num, has_cntl ? 2*len : len); /*