From 06885e9377b76cbe3b2cebbd560901ca85ddb69c Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Sun, 11 Oct 2015 20:28:17 +0200 Subject: [PATCH] Reset aa and original_aa in read_profiles() TL;DR: aa-genprof crashes with a wrong 'Conflicting profiles' error. aa-genprof uses autodep() to create a basic profile, which is then stored in aa and original_aa. After that, read_profiles() is called, which reads all profiles (including the new one) from disk, causing a (wrong) 'Conflicting profiles' error in attach_profile_data() because the autodep()-generated profile is already there. Therefore this patch resets aa and original_aa in read_profiles() to avoid that problem. Acked-by --- utils/apparmor/aa.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils/apparmor/aa.py b/utils/apparmor/aa.py index 5cf521390..26dd633ba 100644 --- a/utils/apparmor/aa.py +++ b/utils/apparmor/aa.py @@ -2463,6 +2463,12 @@ def is_skippable_dir(path): return False def read_profiles(): + # we'll read all profiles from disk, so reset the storage first (autodep() might have created/stored + # a profile already, which would cause a 'Conflicting profile' error in attach_profile_data()) + global aa, original_aa + aa = hasher() + original_aa = hasher() + try: os.listdir(profile_dir) except: