diff --git a/utils/apparmor/aa.py b/utils/apparmor/aa.py index 92a717424..a7f8a675e 100644 --- a/utils/apparmor/aa.py +++ b/utils/apparmor/aa.py @@ -4071,11 +4071,21 @@ def is_known_rule(profile, rule_type, rule_obj): if profile[rule_type].is_covered(rule_obj, False): return True - for incname in profile['include'].keys(): + includelist = list(profile['include'].keys()) + checked = [] + + while includelist: + incname = includelist.pop(0) + checked.append(incname) + if include[incname][incname].get(rule_type, False): if include[incname][incname][rule_type].is_covered(rule_obj, False): return True + for childinc in include[incname][incname]['include'].keys(): + if childinc not in checked: + includelist += [childinc] + return False def reload_base(bin_path):