aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/auditfilter.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-08-31 19:26:40 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2006-09-11 13:32:30 -0400
commit55669bfa141b488be865341ed12e188967d11308 (patch)
treeefeec37a93f46c48937eb849c083da9a42ed3709 /kernel/auditfilter.c
parentdc104fb3231f11e95b5a0f09ae3ab27a8fd5b2e8 (diff)
[PATCH] audit: AUDIT_PERM support
add support for AUDIT_PERM predicate Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel/auditfilter.c')
-rw-r--r--kernel/auditfilter.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index e4cafc11c5..a44879b0c7 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -302,6 +302,15 @@ int __init audit_register_class(int class, unsigned *list)
302 return 0; 302 return 0;
303} 303}
304 304
305int audit_match_class(int class, unsigned syscall)
306{
307 if (unlikely(syscall >= AUDIT_BITMASK_SIZE * sizeof(__u32)))
308 return 0;
309 if (unlikely(class >= AUDIT_SYSCALL_CLASSES || !classes[class]))
310 return 0;
311 return classes[class][AUDIT_WORD(syscall)] & AUDIT_BIT(syscall);
312}
313
305/* Common user-space to kernel rule translation. */ 314/* Common user-space to kernel rule translation. */
306static inline struct audit_entry *audit_to_entry_common(struct audit_rule *rule) 315static inline struct audit_entry *audit_to_entry_common(struct audit_rule *rule)
307{ 316{
@@ -414,6 +423,10 @@ static struct audit_entry *audit_rule_to_entry(struct audit_rule *rule)
414 case AUDIT_ARG2: 423 case AUDIT_ARG2:
415 case AUDIT_ARG3: 424 case AUDIT_ARG3:
416 break; 425 break;
426 case AUDIT_PERM:
427 if (f->val & ~15)
428 goto exit_free;
429 break;
417 case AUDIT_INODE: 430 case AUDIT_INODE:
418 err = audit_to_inode(&entry->rule, f); 431 err = audit_to_inode(&entry->rule, f);
419 if (err) 432 if (err)
@@ -568,6 +581,10 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
568 entry->rule.buflen += f->val; 581 entry->rule.buflen += f->val;
569 entry->rule.filterkey = str; 582 entry->rule.filterkey = str;
570 break; 583 break;
584 case AUDIT_PERM:
585 if (f->val & ~15)
586 goto exit_free;
587 break;
571 default: 588 default:
572 goto exit_free; 589 goto exit_free;
573 } 590 }