Skip to content

Commit 53fc7a0

Browse files
rgbriggspcmoore
authored andcommitted
audit: give a clue what CONFIG_CHANGE op was involved
The failure to add an audit rule due to audit locked gives no clue what CONFIG_CHANGE operation failed. Similarly the set operation is the only other operation that doesn't give the "op=" field to indicate the action. All other CONFIG_CHANGE records include an op= field to give a clue as to what sort of configuration change is being executed. Since these are the only CONFIG_CHANGE records that that do not have an op= field, add them to bring them in line with the rest. Old records: type=CONFIG_CHANGE msg=audit(1519812997.781:374): pid=610 uid=0 auid=0 ses=1 subj=... audit_enabled=2 res=0 type=CONFIG_CHANGE msg=audit(2018-06-14 14:55:04.507:47) : audit_enabled=1 old=1 auid=unset ses=unset subj=... res=yes New records: type=CONFIG_CHANGE msg=audit(1520958477.855:100): pid=610 uid=0 auid=0 ses=1 subj=... op=add_rule audit_enabled=2 res=0 type=CONFIG_CHANGE msg=audit(2018-06-14 14:55:04.507:47) : op=set audit_enabled=1 old=1 auid=unset ses=unset subj=... res=yes See: linux-audit/audit-kernel#59 Signed-off-by: Richard Guy Briggs <rgb@redhat.com> [PM: fixed checkpatch.pl line length problems] Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent bfeffd1 commit 53fc7a0

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎kernel/audit.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ static int audit_log_config_change(char *function_name, u32 new, u32 old,
399399
ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE);
400400
if (unlikely(!ab))
401401
return rc;
402-
audit_log_format(ab, "%s=%u old=%u ", function_name, new, old);
402+
audit_log_format(ab, "op=set %s=%u old=%u ", function_name, new, old);
403403
audit_log_session_info(ab);
404404
rc = audit_log_task_context(ab);
405405
if (rc)
@@ -1362,7 +1362,10 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
13621362
return -EINVAL;
13631363
if (audit_enabled == AUDIT_LOCKED) {
13641364
audit_log_common_recv_msg(&ab, AUDIT_CONFIG_CHANGE);
1365-
audit_log_format(ab, " audit_enabled=%d res=0", audit_enabled);
1365+
audit_log_format(ab, " op=%s audit_enabled=%d res=0",
1366+
msg_type == AUDIT_ADD_RULE ?
1367+
"add_rule" : "remove_rule",
1368+
audit_enabled);
13661369
audit_log_end(ab);
13671370
return -EPERM;
13681371
}

0 commit comments

Comments
 (0)