[apparmor] [patch] Fix aa-mergeprof crash with files containing multiple profiles
Christian Boltz
apparmor at cboltz.de
Sat Dec 26 16:36:51 UTC 2015
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]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20151226/b9d99962/attachment.pgp>
More information about the AppArmor
mailing list