Skip to content

Commit d904ac0

Browse files
rgbriggspcmoore
authored andcommitted
audit: rename FILTER_TYPE to FILTER_EXCLUDE
The AUDIT_FILTER_TYPE name is vague and misleading due to not describing where or when the filter is applied and obsolete due to its available filter fields having been expanded. Userspace has already renamed it from AUDIT_FILTER_TYPE to AUDIT_FILTER_EXCLUDE without checking if it already exists. The userspace maintainer assures that as long as it is set to the same value it will not be a problem since the userspace code does not treat compiler warnings as errors. If this policy changes then checks if it already exists can be added at the same time. See: linux-audit/audit-kernel#89 Signed-off-by: Richard Guy Briggs <rgb@redhat.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent af85d17 commit d904ac0

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎include/uapi/linux/audit.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@
157157
#define AUDIT_FILTER_ENTRY 0x02 /* Apply rule at syscall entry */
158158
#define AUDIT_FILTER_WATCH 0x03 /* Apply rule to file system watches */
159159
#define AUDIT_FILTER_EXIT 0x04 /* Apply rule at syscall exit */
160-
#define AUDIT_FILTER_TYPE 0x05 /* Apply rule at audit_log_start */
160+
#define AUDIT_FILTER_EXCLUDE 0x05 /* Apply rule before record creation */
161+
#define AUDIT_FILTER_TYPE AUDIT_FILTER_EXCLUDE /* obsolete misleading naming */
161162
#define AUDIT_FILTER_FS 0x06 /* Apply rule at __audit_inode_child */
162163

163164
#define AUDIT_NR_FILTERS 7

‎kernel/audit.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1754,7 +1754,7 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
17541754
if (audit_initialized != AUDIT_INITIALIZED)
17551755
return NULL;
17561756

1757-
if (unlikely(!audit_filter(type, AUDIT_FILTER_TYPE)))
1757+
if (unlikely(!audit_filter(type, AUDIT_FILTER_EXCLUDE)))
17581758
return NULL;
17591759

17601760
/* NOTE: don't ever fail/sleep on these two conditions:

‎kernel/auditfilter.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static inline struct audit_entry *audit_to_entry_common(struct audit_rule_data *
264264
case AUDIT_FILTER_TASK:
265265
#endif
266266
case AUDIT_FILTER_USER:
267-
case AUDIT_FILTER_TYPE:
267+
case AUDIT_FILTER_EXCLUDE:
268268
case AUDIT_FILTER_FS:
269269
;
270270
}
@@ -337,7 +337,7 @@ static int audit_field_valid(struct audit_entry *entry, struct audit_field *f)
337337
{
338338
switch(f->type) {
339339
case AUDIT_MSGTYPE:
340-
if (entry->rule.listnr != AUDIT_FILTER_TYPE &&
340+
if (entry->rule.listnr != AUDIT_FILTER_EXCLUDE &&
341341
entry->rule.listnr != AUDIT_FILTER_USER)
342342
return -EINVAL;
343343
break;
@@ -929,7 +929,7 @@ static inline int audit_add_rule(struct audit_entry *entry)
929929
/* If any of these, don't count towards total */
930930
switch(entry->rule.listnr) {
931931
case AUDIT_FILTER_USER:
932-
case AUDIT_FILTER_TYPE:
932+
case AUDIT_FILTER_EXCLUDE:
933933
case AUDIT_FILTER_FS:
934934
dont_count = 1;
935935
}
@@ -1011,7 +1011,7 @@ int audit_del_rule(struct audit_entry *entry)
10111011
/* If any of these, don't count towards total */
10121012
switch(entry->rule.listnr) {
10131013
case AUDIT_FILTER_USER:
1014-
case AUDIT_FILTER_TYPE:
1014+
case AUDIT_FILTER_EXCLUDE:
10151015
case AUDIT_FILTER_FS:
10161016
dont_count = 1;
10171017
}
@@ -1372,7 +1372,7 @@ int audit_filter(int msgtype, unsigned int listtype)
13721372
break;
13731373
}
13741374
if (result > 0) {
1375-
if (e->rule.action == AUDIT_NEVER || listtype == AUDIT_FILTER_TYPE)
1375+
if (e->rule.action == AUDIT_NEVER || listtype == AUDIT_FILTER_EXCLUDE)
13761376
ret = 0;
13771377
break;
13781378
}

0 commit comments

Comments
 (0)