Hello,

if a profile file contains multiple profiles, aa-mergeprof crashes on
saving in write_profile() because the second profile in the file is not
listed in 'changed'.

This patch first checks if 'changed' contains the profile before
pop()ing it.

Reproducer: copy utils/test/cleanprof_test.in to your profile directory
and run   aa-mergeprof utils/test/cleanprof_test.out. Then just press
's' to save the profile.


I can reproduce this with trunk, 2.10 and 2.9 and therefore propose this
patch for all these branches.


[ 47-fix-multi-profile-mergeprof-crash.diff ]

--- utils/apparmor/aa.py        2015-12-26 16:47:30.614839586 +0100
+++ utils/apparmor/aa.py        2015-12-26 17:27:36.376228122 +0100
@@ -4039,7 +4039,11 @@
 
     os.rename(newprof.name, prof_filename)
 
-    changed.pop(profile)
+    if profile in changed:
+        changed.pop(profile)
+    else:
+        debug_logger.error("%s written, but not listed in 'changed' list" % 
profile)
+
     original_aa[profile] = deepcopy(aa[profile])
 
 def matchliteral(aa_regexp, literal):


Regards,

Christian Boltz
-- 
[Glaskugel?] Ich habe früher Aufsicht im Rechnerpool an der Uni gemacht.
Irgendwie hat es die User beeindruckt, wenn ich Ihnen (ohne den Monitor
einsehen zu können und ohne dass die User etwas gesagt hätten) erklärt
habe, dass Word abstürzt, wenn man erst die Diskette entfernt und dann
Word schließt. Das Laufwerksknurpsgeräusch und der Gesichtsausdruck der
User war eindeutig genug... [Antje M. Bendrich in suse-linux]

Attachment: signature.asc
Description: This is a digitally signed message part.

-- 
AppArmor mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to