<div dir="ltr">Hello,<br><div class="gmail_extra"><br></div><div class="gmail_extra">Sorry for the delayed reviews.<br></div><div class="gmail_extra"><div class="gmail_quote">On Tue, Jul 21, 2015 at 1:33 AM, Christian Boltz <span dir="ltr"><<a href="mailto:apparmor@cboltz.de" target="_blank">apparmor@cboltz.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
having two profiles for the same binary is "technically allowed", but it<br>
leads to interesting[tm] behaviour because one of them "wins" depending<br>
on the load order. To make things even more interesting, the kernel load<br>
order can be different from the tools load order, leading to even more<br>
fun.<br>
<br>
Short version: you do _not_ want that situation ;-)<br>
<br>
This patch adds a duplicate check to attach_profile_data() so that it<br>
errors out if it finds duplicate profiles or hats, and lists the profile<br>
files that contain them.<br>
<br>
<br>
This is a nice-to-have for 2.9 too ;-) - but needs the error handling<br>
backported because the exception contains \n (which will be displayed<br>
as literal '\n' in 2.9 as long as it uses the native python exception<br>
handling)<br>
<br></blockquote><div>I can live with a '\n' in the error message for now in 2.9. <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
[ 82-check-for-duplicate-profiles.diff ]<br>
<br>
diff -ru '--exclude=.bzr' ../HEAD-patches-applied/utils/apparmor/aa.py ./utils/apparmor/aa.py<br>
--- utils/apparmor/aa.py 2015-07-20 21:49:17.017253150 +0200<br>
+++ ./utils/apparmor/aa.py 2015-07-20 21:49:06.019905353 +0200<br>
@@ -2517,6 +2517,13 @@<br>
# Make deep copy of data to avoid changes to<br>
# arising due to mutables<br>
for p in profile_data.keys():<br>
+ if profiles.get(p, False):<br>
+ for hat in profile_data[p].keys():<br>
+ if profiles[p].get(hat, False):<br>
+ raise AppArmorException(_("Conflicting profiles for %s defined in two files:\n- %s\n- %s") %<br>
+ # 'filename' is not set for hats, therefore print the filename of the main profile<br>
+ (combine_name(p, hat), profiles[p][p]['filename'], profile_data[p][p]['filename']))<br>
+<br>
profiles[p] = deepcopy(profile_data[p])<br>
<br>
<br></blockquote><div><span class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br></blockquote></span><div>Thanks for the patch.<br><br>Acked-by: Kshitij Gupta <<a href="mailto:kgupta8592@gmail.com" target="_blank">kgupta8592@gmail.com</a>> for both trunk and 2.9.<br><br></div><div><br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br>
Regards,<br>
<br>
Christian Boltz<br>
<span class="HOEnZb"><font color="#888888">--<br>
Sieh an, ein Dichter und Denker, obwohl er sicherlich nicht<br>
mehr ganz dicht ist und auch nicht mehr oft denkt, sonst wäre<br>
er ja nicht bei uns gelandet ;D [Alex Klein in suse-linux]<br>
<br>
<br>
--<br>
AppArmor mailing list<br>
<a href="mailto:AppArmor@lists.ubuntu.com">AppArmor@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/apparmor" rel="noreferrer" target="_blank">https://lists.ubuntu.com/mailman/listinfo/apparmor</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div>Regards,<br><br></div>Kshitij Gupta<br></div></div>
</div></div>