aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Guy Briggs <rgb@redhat.com>2018-06-05 11:45:07 -0400
committerPaul Moore <paul@paul-moore.com>2018-06-19 10:39:54 -0400
commitd904ac0320d3c4ff4e9d80e4294ca5dde803696f (patch)
tree3f504b3d96ce50dd4c9aa6724aa784c6f4c852a9
parentaf85d1772e31fed34165a1b3decef340cf4080c0 (diff)
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: https://github.com/linux-audit/audit-kernel/issues/89 Signed-off-by: Richard Guy Briggs <rgb@redhat.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
-rw-r--r--include/uapi/linux/audit.h3
-rw-r--r--kernel/audit.c2
-rw-r--r--kernel/auditfilter.c10
3 files changed, 8 insertions, 7 deletions
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index c35aee9ad4a6..4e3eaba84175 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -157,7 +157,8 @@
157#define AUDIT_FILTER_ENTRY 0x02 /* Apply rule at syscall entry */ 157#define AUDIT_FILTER_ENTRY 0x02 /* Apply rule at syscall entry */
158#define AUDIT_FILTER_WATCH 0x03 /* Apply rule to file system watches */ 158#define AUDIT_FILTER_WATCH 0x03 /* Apply rule to file system watches */
159#define AUDIT_FILTER_EXIT 0x04 /* Apply rule at syscall exit */ 159#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 */
161#define AUDIT_FILTER_FS 0x06 /* Apply rule at __audit_inode_child */ 162#define AUDIT_FILTER_FS 0x06 /* Apply rule at __audit_inode_child */
162 163
163#define AUDIT_NR_FILTERS 7 164#define AUDIT_NR_FILTERS 7
diff --git a/kernel/audit.c b/kernel/audit.c
index e7478cb58079..5c0a1d7b0c7b 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1754,7 +1754,7 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
1754 if (audit_initialized != AUDIT_INITIALIZED) 1754 if (audit_initialized != AUDIT_INITIALIZED)
1755 return NULL; 1755 return NULL;
1756 1756
1757 if (unlikely(!audit_filter(type, AUDIT_FILTER_TYPE))) 1757 if (unlikely(!audit_filter(type, AUDIT_FILTER_EXCLUDE)))
1758 return NULL; 1758 return NULL;
1759 1759
1760 /* NOTE: don't ever fail/sleep on these two conditions: 1760 /* NOTE: don't ever fail/sleep on these two conditions:
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 6db9847ca031..bf309f2592c4 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -264,7 +264,7 @@ static inline struct audit_entry *audit_to_entry_common(struct audit_rule_data *
264 case AUDIT_FILTER_TASK: 264 case AUDIT_FILTER_TASK:
265#endif 265#endif
266 case AUDIT_FILTER_USER: 266 case AUDIT_FILTER_USER:
267 case AUDIT_FILTER_TYPE: 267 case AUDIT_FILTER_EXCLUDE:
268 case AUDIT_FILTER_FS: 268 case AUDIT_FILTER_FS:
269 ; 269 ;
270 } 270 }
@@ -337,7 +337,7 @@ static int audit_field_valid(struct audit_entry *entry, struct audit_field *f)
337{ 337{
338 switch(f->type) { 338 switch(f->type) {
339 case AUDIT_MSGTYPE: 339 case AUDIT_MSGTYPE:
340 if (entry->rule.listnr != AUDIT_FILTER_TYPE && 340 if (entry->rule.listnr != AUDIT_FILTER_EXCLUDE &&
341 entry->rule.listnr != AUDIT_FILTER_USER) 341 entry->rule.listnr != AUDIT_FILTER_USER)
342 return -EINVAL; 342 return -EINVAL;
343 break; 343 break;
@@ -929,7 +929,7 @@ static inline int audit_add_rule(struct audit_entry *entry)
929 /* If any of these, don't count towards total */ 929 /* If any of these, don't count towards total */
930 switch(entry->rule.listnr) { 930 switch(entry->rule.listnr) {
931 case AUDIT_FILTER_USER: 931 case AUDIT_FILTER_USER:
932 case AUDIT_FILTER_TYPE: 932 case AUDIT_FILTER_EXCLUDE:
933 case AUDIT_FILTER_FS: 933 case AUDIT_FILTER_FS:
934 dont_count = 1; 934 dont_count = 1;
935 } 935 }
@@ -1011,7 +1011,7 @@ int audit_del_rule(struct audit_entry *entry)
1011 /* If any of these, don't count towards total */ 1011 /* If any of these, don't count towards total */
1012 switch(entry->rule.listnr) { 1012 switch(entry->rule.listnr) {
1013 case AUDIT_FILTER_USER: 1013 case AUDIT_FILTER_USER:
1014 case AUDIT_FILTER_TYPE: 1014 case AUDIT_FILTER_EXCLUDE:
1015 case AUDIT_FILTER_FS: 1015 case AUDIT_FILTER_FS:
1016 dont_count = 1; 1016 dont_count = 1;
1017 } 1017 }
@@ -1372,7 +1372,7 @@ int audit_filter(int msgtype, unsigned int listtype)
1372 break; 1372 break;
1373 } 1373 }
1374 if (result > 0) { 1374 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)
1376 ret = 0; 1376 ret = 0;
1377 break; 1377 break;
1378 } 1378 }