[apparmor] [patch] fix crash in save_profiles()

Steve Beattie steve at nxnw.org
Tue Jul 22 06:51:21 UTC 2014


On Sun, Jul 13, 2014 at 03:00:09PM +0200, Christian Boltz wrote:
> Hello,
> 
> this patch fixes a crash in aa-logprof (to be exact: save_profiles() in 
> aa.py) when saving the remaining profile after using "save selected 
> profile".
> 
> When using "save selected profile", write_profile() (called by 
> write_profile_ui_feedback()) does "changed.pop(profile_name)". 
> However, saving the remaining profiles in save_profiles() uses a cached 
> version of changed.keys() and therefore tries to save a profile that 
> was already saved and is no longer part of "changed".
> 
> Here's what save_profiles() does:
> 
>     changed_list = sorted(changed.keys())
> [...]
>                 if ans == 'CMD_SAVE_SELECTED':
>                     profile_name = list(changed.keys())[arg]
>                     write_profile_ui_feedback(profile_name)
> 
> Note that write_profile_ui_feedback() calls write_profile(), which does 
> "changed.pop(profile_name)"
> 
> [...]
>             for profile_name in changed_list:
>                 write_profile_ui_feedback(profile_name)
> 
> When finally saving the remaining profiles, the outdated changed_list 
> is used.
> 
> 
> The patch also removes two commented lines we'll never need again:
> - #changed.pop is done in write_profile()
> - q['options'] is set some lines above
> 
> References: https://bugs.launchpad.net/apparmor/+bug/1341178

Acked-by: Steve Beattie <steve at nxnw.org>

Thanks.

-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20140721/4393a8f2/attachment.pgp>


More information about the AppArmor mailing list