diff options
author | Richard Guy Briggs <rgb@redhat.com> | 2017-01-13 03:26:29 -0500 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2017-01-18 14:32:52 -0500 |
commit | 92c82e8a322b32a6cabe7d8800dc10401157a623 (patch) | |
tree | 32efb225fd981c63024087f030165baeb37e761c /kernel/audit.c | |
parent | 89670affa2a62c4868a2dd8a4195a1a2ec58cb27 (diff) |
audit: add feature audit_lost reset
Add a method to reset the audit_lost value.
An AUDIT_SET message with the AUDIT_STATUS_LOST flag set by itself
will return a positive value repesenting the current audit_lost value
and reset the counter to zero. If AUDIT_STATUS_LOST is not the
only flag set, the reset command will be ignored. The value sent with
the command is ignored. The return value will be the +ve lost value at
reset time.
An AUDIT_CONFIG_CHANGE message will be queued to the listening audit
daemon. The message will be a standard CONFIG_CHANGE message with the
fields "lost=0" and "old=" with the latter containing the value of
audit_lost at reset time.
See: https://github.com/linux-audit/audit-kernel/issues/3
Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Acked-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'kernel/audit.c')
-rw-r--r-- | kernel/audit.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index 57acf2541fdd..25dd70a588b2 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -121,7 +121,7 @@ u32 audit_sig_sid = 0; | |||
121 | 3) suppressed due to audit_rate_limit | 121 | 3) suppressed due to audit_rate_limit |
122 | 4) suppressed due to audit_backlog_limit | 122 | 4) suppressed due to audit_backlog_limit |
123 | */ | 123 | */ |
124 | static atomic_t audit_lost = ATOMIC_INIT(0); | 124 | static atomic_t audit_lost = ATOMIC_INIT(0); |
125 | 125 | ||
126 | /* The netlink socket. */ | 126 | /* The netlink socket. */ |
127 | static struct sock *audit_sock; | 127 | static struct sock *audit_sock; |
@@ -1052,6 +1052,12 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
1052 | if (err < 0) | 1052 | if (err < 0) |
1053 | return err; | 1053 | return err; |
1054 | } | 1054 | } |
1055 | if (s.mask == AUDIT_STATUS_LOST) { | ||
1056 | u32 lost = atomic_xchg(&audit_lost, 0); | ||
1057 | |||
1058 | audit_log_config_change("lost", 0, lost, 1); | ||
1059 | return lost; | ||
1060 | } | ||
1055 | break; | 1061 | break; |
1056 | } | 1062 | } |
1057 | case AUDIT_GET_FEATURE: | 1063 | case AUDIT_GET_FEATURE: |