audit: printk USER_AVC messages when audit isn't enabled
PATCH 1/1 audit: printk USER_AVC messages when audit isn't enabled
When the audit=1 kernel parameter is absent and auditd is not running, AUDIT_USER_AVC messages are being silently discarded.
AUDIT_USER_AVC messages should be sent to userspace using printk(), as mentioned in the commit message of 4a4cd633b575609b741a1de7837223a2d9e1c34c ("AUDIT: Optimise the audit-disabled case for discarding user messages").
When audit_enabled is 0, audit_receive_msg() discards all user messages except for AUDIT_USER_AVC messages. However, audit_log_common_recv_msg() refuses to allocate an audit_buffer if audit_enabled is 0. The fix is to special case AUDIT_USER_AVC messages in both functions.
---
It looks like commit 50397bd1e471391d27f64efad9271459c913de87 ("[AUDIT] clean up audit_receive_msg()") introduced this bug, so I think that this patch should also get the tag:
Al and Eric, I'll leave that up to you two.
Here's my test matrix showing where messages end up as a result of a call to libaudit's audit_log_user_avc_message():
| unpatched patched
----------------+--------------------------------
w/o audit=1 & | *dropped* syslog
w/o auditd |
| w/ audit=1 & | syslog syslog w/o auditd | | w/o audit=1 & | audit.log audit.log w/ auditd | |
w/ audit=1 & | audit.log audit.log
w/ auditd |
Thanks!
kernel/audit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/audit.c +1 -1
@@ -613,7 +613,7 @@ static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type)int rc =0 ;uid_t uid =from_kuid (&init_user_ns,current_uid ()); -if (!audit_enabled) { +if (!audit_enabled && msg_type !=AUDIT_USER_AVC ) { *ab =NULL ;return rc; }
Signature · 1 line
1.8.3.2
Quoted 13 lines · Tyler Hicks
When the audit=1 kernel parameter is absent and auditd is not running,
AUDIT_USER_AVCmessages are being silently discarded.
AUDIT_USER_AVCmessages should be sent to userspace usingprintk(), as mentioned in the commit message of4a4cd633b575609b741a1de7837223a2d9e1c34c("AUDIT: Optimise the audit-disabled case for discarding user messages").When
audit_enabledis 0,audit_receive_msg()discards all user messages except forAUDIT_USER_AVCmessages. However,audit_log_common_recv_msg()refuses to allocate anaudit_bufferifaudit_enabledis 0. The fix is to special caseAUDIT_USER_AVCmessages in both functions.
Quoted 5 lines
Signed-off-by Tyler Hicks <[email protected]>Cc Al Viro <[email protected]>Cc Eric Paris <[email protected]>---
Hello Al and Eric - I wanted to bring this patch back to your attention so it doesn't get forgotten. This is a fairly nasty bug in distros that leave auditd as optional but still build packages against libaudit.
Thanks!
Tyler
Quoted 52 lines
It looks like commit
50397bd1e471391d27f64efad9271459c913de87("[AUDIT] clean upaudit_receive_msg()") introduced this bug, so I think that this patch should also get the tag:Cc <[email protected]> # v2.6.25+Al and Eric, I'll leave that up to you two.
Here's my test matrix showing where messages end up as a result of a call to libaudit's
audit_log_user_avc_message():| unpatched patched
----------------+--------------------------------
w/o audit=1 & | *dropped* syslog
w/o auditd || w/ audit=1 & | syslog syslog w/o auditd | | w/o audit=1 & | audit.log audit.log w/ auditd | |w/ audit=1 & | audit.log audit.log
w/ auditd |Thanks!
kernel/audit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/audit.c +1
-1@@ -613,7 +613,7 @@ static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type)int rc =0 ;uid_t uid =from_kuid (&init_user_ns,current_uid ()); -if (!audit_enabled) { +if (!audit_enabled && msg_type !=AUDIT_USER_AVC ) { *ab =NULL ;return rc; }Signature · 6 lines
1.8.3.2 -- Linux-audit mailing list [email protected] https://www.redhat.com/mailman/listinfo/linux-audit
Kees Cook
Acked-byQuoted 20 lines · Tyler Hicks
Quoted 13 lines · Tyler Hicks
When the audit=1 kernel parameter is absent and auditd is not running,
AUDIT_USER_AVCmessages are being silently discarded.
AUDIT_USER_AVCmessages should be sent to userspace usingprintk(), as mentioned in the commit message of4a4cd633b575609b741a1de7837223a2d9e1c34c("AUDIT: Optimise the audit-disabled case for discarding user messages").When
audit_enabledis 0,audit_receive_msg()discards all user messages except forAUDIT_USER_AVCmessages. However,audit_log_common_recv_msg()refuses to allocate anaudit_bufferifaudit_enabledis 0. The fix is to special caseAUDIT_USER_AVCmessages in both functions.Quoted 5 lines
Signed-off-by Tyler Hicks <[email protected]>Cc Al Viro <[email protected]>Cc Eric Paris <[email protected]>---
Quoted 3 lines
Hello Al and Eric - I wanted to bring this patch back to your attention so it doesn't get forgotten. This is a fairly nasty bug in distros that leave auditd as optional but still build packages against libaudit.
I haven't seen a lot of movement in the audit tree lately, but Andrew has helped push other fixes like this in the past. This fix seems entirely reasonable to me. :) Andrew, can you pick this up?
Quoted 11 lines
Thanks!
Tyler
Quoted 6 lines
It looks like commit
50397bd1e471391d27f64efad9271459c913de87("[AUDIT] clean upaudit_receive_msg()") introduced this bug, so I think that this patch should also get the tag:Cc <[email protected]> # v2.6.25+
Yeah, this seems like a good idea too.
Thanks,
-Kees
Quoted 51 lines
Quoted 42 lines
Al and Eric, I'll leave that up to you two.
Here's my test matrix showing where messages end up as a result of a call to libaudit's
audit_log_user_avc_message():| unpatched patched
----------------+--------------------------------w/o audit=1 & | *dropped* syslog w/o auditd | | w/ audit=1 & | syslog syslog w/o auditd | | w/o audit=1 & | audit.log audit.log w/ auditd | | w/ audit=1 & | audit.log audit.log w/ auditd |Thanks!
kernel/audit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/audit.c +1
-2@@ -613,7 +613,7 @@ static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type)int rc =0 ;uid_t uid =from_kuid (&init_user_ns,current_uid ()); -if (!audit_enabled) { +if (!audit_enabled && msg_type !=AUDIT_USER_AVC ) { *ab =NULL ;return rc; } --1.8.3.2
Quoted 4 lines
--
Linux-audit mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-audit--
Linux-audit mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-audit
Signature · 2 lines
Kees Cook Chrome OS Security
Quoted 21 lines · Kees Cook
Quoted 20 lines · Tyler Hicks
Quoted 18 lines · Tyler Hicks
When the audit=1 kernel parameter is absent and auditd is not running,
AUDIT_USER_AVCmessages are being silently discarded.
AUDIT_USER_AVCmessages should be sent to userspace usingprintk(), as mentioned in the commit message of4a4cd633b575609b741a1de7837223a2d9e1c34c("AUDIT: Optimise the audit-disabled case for discarding user messages").When
audit_enabledis 0,audit_receive_msg()discards all user messages except forAUDIT_USER_AVCmessages. However,audit_log_common_recv_msg()refuses to allocate anaudit_bufferifaudit_enabledis 0. The fix is to special caseAUDIT_USER_AVCmessages in both functions.Signed-off-by Tyler Hicks <[email protected]>Cc Al Viro <[email protected]>Cc Eric Paris <[email protected]>---
Quoted 7 lines
Quoted 3 lines
Hello Al and Eric - I wanted to bring this patch back to your attention so it doesn't get forgotten. This is a fairly nasty bug in distros that leave auditd as optional but still build packages against libaudit.
I haven't seen a lot of movement in the audit tree lately, but Andrew has helped push other fixes like this in the past. This fix seems entirely reasonable to me. :) Andrew, can you pick this up?
This has also raised questions about AUDIT_USER_SELINUX_ERR, and whether that should be special-cased to allow it through to syslog if audit is disabled.
There wasn't originally a special case for AUDIT_USER_SELINUX_ERR. Should one be added at this time?
Quoted 62 lines
Acked-by Kees Cook <[email protected]>Quoted 11 lines
Thanks!
Tyler
Quoted 6 lines
It looks like commit
50397bd1e471391d27f64efad9271459c913de87("[AUDIT] clean upaudit_receive_msg()") introduced this bug, so I think that this patch should also get the tag:Cc <[email protected]> # v2.6.25+Yeah, this seems like a good idea too.
Thanks,
-Kees
Quoted 42 lines
Quoted 42 lines
Al and Eric, I'll leave that up to you two.
Here's my test matrix showing where messages end up as a result of a call to libaudit's
audit_log_user_avc_message():| unpatched patched
----------------+--------------------------------w/o audit=1 & | *dropped* syslog w/o auditd | | w/ audit=1 & | syslog syslog w/o auditd | | w/o audit=1 & | audit.log audit.log w/ auditd | | w/ audit=1 & | audit.log audit.log w/ auditd |Thanks!
kernel/audit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/audit.c +1
-2@@ -613,7 +613,7 @@ static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type)int rc =0 ;uid_t uid =from_kuid (&init_user_ns,current_uid ()); -if (!audit_enabled) { +if (!audit_enabled && msg_type !=AUDIT_USER_AVC ) { *ab =NULL ;return rc; } --1.8.3.2
Quoted 20 lines
Quoted 9 lines
Quoted 4 lines
--
Linux-audit mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-audit--
Linux-audit mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-auditSignature · 7 lines
Kees Cook Chrome OS Security -- Linux-audit mailing list [email protected] https://www.redhat.com/mailman/listinfo/linux-audit
- RGB
--
Richard Guy Briggs <[email protected]>
Senior Software Engineer, Kernel Security, AMER ENG Base Operating Systems, Red Hat Remote, Ottawa, Canada
Voice: +1.647.777.2635, Internal: (81) 32635, Alt: +1.613.693.0684x3545
Quoted 19 lines · Tyler Hicks
When the audit=1 kernel parameter is absent and auditd is not running,
AUDIT_USER_AVCmessages are being silently discarded.
AUDIT_USER_AVCmessages should be sent to userspace usingprintk(), as mentioned in the commit message of4a4cd633b575609b741a1de7837223a2d9e1c34c("AUDIT: Optimise the audit-disabled case for discarding user messages").When
audit_enabledis 0,audit_receive_msg()discards all user messages except forAUDIT_USER_AVCmessages. However,audit_log_common_recv_msg()refuses to allocate anaudit_bufferifaudit_enabledis 0. The fix is to special caseAUDIT_USER_AVCmessages in both functions.Signed-off-by Tyler Hicks <[email protected]>Cc Al Viro <[email protected]>Cc Eric Paris <[email protected]>---
Quoted 7 lines
It looks like commit
50397bd1e471391d27f64efad9271459c913de87("[AUDIT] clean upaudit_receive_msg()") introduced this bug, so I think that this patch should also get the tag:Cc <[email protected]> # v2.6.25+Al and Eric, I'll leave that up to you two.
Hi Tyler,
This patch looks entirely reasonable to me.
Quoted 42 lines
Here's my test matrix showing where messages end up as a result of a call to libaudit's
audit_log_user_avc_message():| unpatched patched
----------------+--------------------------------
w/o audit=1 & | *dropped* syslog
w/o auditd || w/ audit=1 & | syslog syslog w/o auditd | | w/o audit=1 & | audit.log audit.log w/ auditd | |w/ audit=1 & | audit.log audit.log
w/ auditd |Thanks!
kernel/audit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/audit.c +1
-1@@ -613,7 +613,7 @@ static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type)int rc =0 ;uid_t uid =from_kuid (&init_user_ns,current_uid ()); -if (!audit_enabled) { +if (!audit_enabled && msg_type !=AUDIT_USER_AVC ) { *ab =NULL ;return rc; }Signature · 6 lines
1.8.3.2 -- Linux-audit mailing list [email protected] https://www.redhat.com/mailman/listinfo/linux-audit
- RGB
--
Richard Guy Briggs <[email protected]>
Senior Software Engineer
Kernel Security
AMER ENG Base Operating Systems
Remote, Ottawa, Canada
Voice: +1.647.777.2635
Internal: (81) 32635
Alt: +1.613.693.0684x3545