Skip to content

Commit 37eebe3

Browse files
milabseparis
authored andcommitted
audit: improve GID/EGID comparation logic
It is useful to extend GID/EGID comparation logic to be able to match not only the exact EID/EGID values but the group/egroup also. Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com> Signed-off-by: Eric Paris <eparis@redhat.com>
1 parent 19f949f commit 37eebe3

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎kernel/auditsc.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,9 +633,23 @@ static int audit_filter_rules(struct task_struct *tsk,
633633
break;
634634
case AUDIT_GID:
635635
result = audit_gid_comparator(cred->gid, f->op, f->gid);
636+
if (f->op == Audit_equal) {
637+
if (!result)
638+
result = in_group_p(f->gid);
639+
} else if (f->op == Audit_not_equal) {
640+
if (result)
641+
result = !in_group_p(f->gid);
642+
}
636643
break;
637644
case AUDIT_EGID:
638645
result = audit_gid_comparator(cred->egid, f->op, f->gid);
646+
if (f->op == Audit_equal) {
647+
if (!result)
648+
result = in_egroup_p(f->gid);
649+
} else if (f->op == Audit_not_equal) {
650+
if (result)
651+
result = !in_egroup_p(f->gid);
652+
}
639653
break;
640654
case AUDIT_SGID:
641655
result = audit_gid_comparator(cred->sgid, f->op, f->gid);

0 commit comments

Comments
 (0)