Skip to content

Commit

Permalink
selinux: fix avc audit messages
Browse files Browse the repository at this point in the history
commit a2c5138 ("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: a2c5138 ("selinux: inline some AVC functions used only once")
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <paul@paul-moore.com>
  • Loading branch information
Stephen Smalley authored and Paul Moore committed Feb 5, 2019
1 parent e6f2f38 commit 45189a1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions security/selinux/avc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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 ");
}

/**
Expand Down

0 comments on commit 45189a1

Please sign in to comment.