Skip to content

Commit

Permalink
audit: fix formatting of AUDIT_CONFIG_CHANGE events
Browse files Browse the repository at this point in the history
The AUDIT_CONFIG_CHANGE events sometimes use a op= field. The current
code logs the value of the field with quotes. This field is documented
to not be encoded, so it should not have quotes.

Signed-off-by: Steve Grubb <[email protected]>
Reviewed-by: Richard Guy Briggs <[email protected]>
[PM: reformatted commit description to make checkpatch.pl happy]
Signed-off-by: Paul Moore <[email protected]>
  • Loading branch information
RH-steve-grubb authored and pcmoore committed Nov 20, 2016
1 parent 833fc48 commit c1e8f06
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
5 changes: 2 additions & 3 deletions kernel/audit_fsnotify.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,9 @@ static void audit_mark_log_rule_change(struct audit_fsnotify_mark *audit_mark, c
ab = audit_log_start(NULL, GFP_NOFS, AUDIT_CONFIG_CHANGE);
if (unlikely(!ab))
return;
audit_log_format(ab, "auid=%u ses=%u op=",
audit_log_format(ab, "auid=%u ses=%u op=%s",
from_kuid(&init_user_ns, audit_get_loginuid(current)),
audit_get_sessionid(current));
audit_log_string(ab, op);
audit_get_sessionid(current), op);
audit_log_format(ab, " path=");
audit_log_untrustedstring(ab, audit_mark->path);
audit_log_key(ab, rule->filterkey);
Expand Down
3 changes: 1 addition & 2 deletions kernel/audit_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,7 @@ static void audit_tree_log_remove_rule(struct audit_krule *rule)
ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE);
if (unlikely(!ab))
return;
audit_log_format(ab, "op=");
audit_log_string(ab, "remove_rule");
audit_log_format(ab, "op=remove_rule");
audit_log_format(ab, " dir=");
audit_log_untrustedstring(ab, rule->tree->pathname);
audit_log_key(ab, rule->filterkey);
Expand Down
5 changes: 2 additions & 3 deletions kernel/audit_watch.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,9 @@ static void audit_watch_log_rule_change(struct audit_krule *r, struct audit_watc
ab = audit_log_start(NULL, GFP_NOFS, AUDIT_CONFIG_CHANGE);
if (unlikely(!ab))
return;
audit_log_format(ab, "auid=%u ses=%u op=",
audit_log_format(ab, "auid=%u ses=%u op=%s",
from_kuid(&init_user_ns, audit_get_loginuid(current)),
audit_get_sessionid(current));
audit_log_string(ab, op);
audit_get_sessionid(current), op);
audit_log_format(ab, " path=");
audit_log_untrustedstring(ab, w->path);
audit_log_key(ab, r->filterkey);
Expand Down
3 changes: 1 addition & 2 deletions kernel/auditfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1074,8 +1074,7 @@ static void audit_log_rule_change(char *action, struct audit_krule *rule, int re
return;
audit_log_format(ab, "auid=%u ses=%u" ,loginuid, sessionid);
audit_log_task_context(ab);
audit_log_format(ab, " op=");
audit_log_string(ab, action);
audit_log_format(ab, " op=%s", action);
audit_log_key(ab, rule->filterkey);
audit_log_format(ab, " list=%d res=%d", rule->listnr, res);
audit_log_end(ab);
Expand Down

0 comments on commit c1e8f06

Please sign in to comment.