Skip to content

Commit

Permalink
libsepol: Do not reject all type rules in conditionals when validating
Browse files Browse the repository at this point in the history
Commit 1c91bc8 ("libsepol: reject self flag in type rules in old
policies") actually rejects all type rules in conditionals in modular
policies prior to version 21 (MOD_POLICYDB_VERSION_SELF_TYPETRANS).

The problem is because of fall-through in a switch statement when
the avrule flags are 0. Instead, break rather than fall-through when
avrule flags are 0.

Reviewed-by: Christian Göttsche <[email protected]>
Acked-by: Petr Lautrbach <[email protected]>
  • Loading branch information
jwcart2 committed Jun 21, 2024
1 parent e6c99f3 commit 1efc121
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions libsepol/src/policydb_validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,7 @@ static int validate_avrules(sepol_handle_t *handle, const avrule_t *avrule, int

switch(avrule->flags) {
case 0:
break;
case RULE_SELF:
if (p->policyvers != POLICY_KERN &&
p->policyvers < MOD_POLICYDB_VERSION_SELF_TYPETRANS &&
Expand Down

0 comments on commit 1efc121

Please sign in to comment.