lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <TY0PR03MB627527D223A19E65A5DA14E8A36E9@TY0PR03MB6275.apcprd03.prod.outlook.com>
Date:   Sun, 21 Aug 2022 22:21:55 +0800
From:   Ecronic <ecronic@...look.com>
To:     paul@...l-moore.com, eparis@...hat.com, ecronic@...look.com
Cc:     linux-audit@...hat.com, linux-kernel@...r.kernel.org
Subject: [PATCH next] audit: printk before dropping logs in audit_log_end

If the log rate of audit exceeds audit_rate_limit, audit_log_end
will drop the audit logs. Printk before dropping them may be a
better choice.

Signed-off-by: Ecronic <ecronic@...look.com>
---
 kernel/audit.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index a75978ae38ad..3f5be93447cb 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -2415,10 +2415,10 @@ void audit_log_end(struct audit_buffer *ab)
 	if (!ab)
 		return;
 
-	if (audit_rate_check()) {
-		skb = ab->skb;
-		ab->skb = NULL;
+	skb = ab->skb;
+	ab->skb = NULL;
 
+	if (audit_rate_check()) {
 		/* setup the netlink header, see the comments in
 		 * kauditd_send_multicast_skb() for length quirks */
 		nlh = nlmsg_hdr(skb);
@@ -2427,8 +2427,11 @@ void audit_log_end(struct audit_buffer *ab)
 		/* queue the netlink packet and poke the kauditd thread */
 		skb_queue_tail(&audit_queue, skb);
 		wake_up_interruptible(&kauditd_wait);
-	} else
+	} else {
+		kauditd_printk_skb(skb);
+		kfree_skb(skb);
 		audit_log_lost("rate limit exceeded");
+	}
 
 	audit_buffer_free(ab);
 }
-- 
2.30.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ