* [PATCH] selinux: fix avc audit messages
@ 2019-02-05 16:49 Stephen Smalley
2019-02-05 17:45 ` Paul Moore
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Smalley @ 2019-02-05 16:49 UTC (permalink / raw)
To: paul; +Cc: selinux, omosnace, Stephen Smalley
commit a2c513835bb6c6 ("selinux: inline some AVC functions used only once")
introduced usage of audit_log_string() in place of audit_log_format()
for fixed strings. However, audit_log_string() quotes the string.
This breaks the avc audit message format and userspace audit parsers.
Switch back to using audit_log_format().
Fixes: a2c513835bb6c6 ("selinux: inline some AVC functions used only once")
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
---
security/selinux/avc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index 33863298a9b5..8346a4f7c5d7 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -674,13 +674,13 @@ static void avc_audit_pre_callback(struct audit_buffer *ab, void *a)
audit_log_format(ab, "avc: %s ", sad->denied ? "denied" : "granted");
if (av == 0) {
- audit_log_string(ab, " null");
+ audit_log_format(ab, " null");
return;
}
perms = secclass_map[sad->tclass-1].perms;
- audit_log_string(ab, " {");
+ audit_log_format(ab, " {");
i = 0;
perm = 1;
while (i < (sizeof(av) * 8)) {
@@ -695,7 +695,7 @@ static void avc_audit_pre_callback(struct audit_buffer *ab, void *a)
if (av)
audit_log_format(ab, " 0x%x", av);
- audit_log_string(ab, " } for ");
+ audit_log_format(ab, " } for ");
}
/**
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] selinux: fix avc audit messages
2019-02-05 16:49 [PATCH] selinux: fix avc audit messages Stephen Smalley
@ 2019-02-05 17:45 ` Paul Moore
0 siblings, 0 replies; 2+ messages in thread
From: Paul Moore @ 2019-02-05 17:45 UTC (permalink / raw)
To: Stephen Smalley; +Cc: selinux, omosnace
On Tue, Feb 5, 2019 at 11:49 AM Stephen Smalley <sds@tycho.nsa.gov> wrote:
> commit a2c513835bb6c6 ("selinux: inline some AVC functions used only once")
> introduced usage of audit_log_string() in place of audit_log_format()
> for fixed strings. However, audit_log_string() quotes the string.
> This breaks the avc audit message format and userspace audit parsers.
> Switch back to using audit_log_format().
>
> Fixes: a2c513835bb6c6 ("selinux: inline some AVC functions used only once")
> Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
> ---
> security/selinux/avc.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Thanks Stephen, I've been burned on this in the past too, I'm
disappointed that I didn't catch this originally :/
> diff --git a/security/selinux/avc.c b/security/selinux/avc.c
> index 33863298a9b5..8346a4f7c5d7 100644
> --- a/security/selinux/avc.c
> +++ b/security/selinux/avc.c
> @@ -674,13 +674,13 @@ static void avc_audit_pre_callback(struct audit_buffer *ab, void *a)
> audit_log_format(ab, "avc: %s ", sad->denied ? "denied" : "granted");
>
> if (av == 0) {
> - audit_log_string(ab, " null");
> + audit_log_format(ab, " null");
> return;
> }
>
> perms = secclass_map[sad->tclass-1].perms;
>
> - audit_log_string(ab, " {");
> + audit_log_format(ab, " {");
> i = 0;
> perm = 1;
> while (i < (sizeof(av) * 8)) {
> @@ -695,7 +695,7 @@ static void avc_audit_pre_callback(struct audit_buffer *ab, void *a)
> if (av)
> audit_log_format(ab, " 0x%x", av);
>
> - audit_log_string(ab, " } for ");
> + audit_log_format(ab, " } for ");
> }
>
> /**
> --
> 2.20.1
>
--
paul moore
www.paul-moore.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-02-05 17:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-05 16:49 [PATCH] selinux: fix avc audit messages Stephen Smalley
2019-02-05 17:45 ` Paul Moore
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).