aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/auditsc.c
diff options
context:
space:
mode:
authorRichard Guy Briggs <rgb@redhat.com>2019-05-22 17:52:02 -0400
committerPaul Moore <paul@paul-moore.com>2019-05-28 17:46:43 -0400
commit0223fad3c98a9588c159a35dda2ef6e68ca27e3f (patch)
tree35db4ae7622bb91db2a049d0d01249f8c566754e /kernel/auditsc.c
parentbf361231c295d92a28ca283ea713f56e93e55796 (diff)
audit: enforce op for string fields
The field operator is ignored on several string fields. WATCH, DIR, PERM and FILETYPE field operators are completely ignored and meaningless since the op is not referenced in audit_filter_rules(). Range and bitwise operators are already addressed in ghak73. Honour the operator for WATCH, DIR, PERM, FILETYPE fields as is done in the EXE field. Please see github issue https://github.com/linux-audit/audit-kernel/issues/114 Signed-off-by: Richard Guy Briggs <rgb@redhat.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r--kernel/auditsc.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 9134fe11ff6c..4effe01ebbe2 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -601,12 +601,20 @@ static int audit_filter_rules(struct task_struct *tsk,
601 } 601 }
602 break; 602 break;
603 case AUDIT_WATCH: 603 case AUDIT_WATCH:
604 if (name) 604 if (name) {
605 result = audit_watch_compare(rule->watch, name->ino, name->dev); 605 result = audit_watch_compare(rule->watch,
606 name->ino,
607 name->dev);
608 if (f->op == Audit_not_equal)
609 result = !result;
610 }
606 break; 611 break;
607 case AUDIT_DIR: 612 case AUDIT_DIR:
608 if (ctx) 613 if (ctx) {
609 result = match_tree_refs(ctx, rule->tree); 614 result = match_tree_refs(ctx, rule->tree);
615 if (f->op == Audit_not_equal)
616 result = !result;
617 }
610 break; 618 break;
611 case AUDIT_LOGINUID: 619 case AUDIT_LOGINUID:
612 result = audit_uid_comparator(audit_get_loginuid(tsk), 620 result = audit_uid_comparator(audit_get_loginuid(tsk),
@@ -689,9 +697,13 @@ static int audit_filter_rules(struct task_struct *tsk,
689 break; 697 break;
690 case AUDIT_PERM: 698 case AUDIT_PERM:
691 result = audit_match_perm(ctx, f->val); 699 result = audit_match_perm(ctx, f->val);
700 if (f->op == Audit_not_equal)
701 result = !result;
692 break; 702 break;
693 case AUDIT_FILETYPE: 703 case AUDIT_FILETYPE:
694 result = audit_match_filetype(ctx, f->val); 704 result = audit_match_filetype(ctx, f->val);
705 if (f->op == Audit_not_equal)
706 result = !result;
695 break; 707 break;
696 case AUDIT_FIELD_COMPARE: 708 case AUDIT_FIELD_COMPARE:
697 result = audit_field_compare(tsk, cred, f, ctx, name); 709 result = audit_field_compare(tsk, cred, f, ctx, name);