apparmor cache not updated when apparmor.d rules change (breaks 15.04/stable -> 15.04/edge updates)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snappy |
Fix Released
|
Critical
|
Michael Vogt | ||
15.04 |
Fix Released
|
Critical
|
Michael Vogt | ||
apparmor (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
The apparmor cache gets confused easily on upgrade.
Here is what happens:
- boot stable, /etc/apparmor.
- upgrade to edge, /etc/apparmor.
- on the next reboot the apparmor_parser compares the mtime of the cache/usr.
-> cache does is *not* re-generate
Possible solution:
- clear cache on upgrade
- make apparmor_parser store mtime of the source file in the header
- make apparmor_parser use set the cache file to the mtime of the source file used to generate the cache and re-generate if those get out-of-sync
Original description:
-------
Rick Spencer ran into the situation that he ended up with a snappy image that gave the following error:
"""
apparmor="DENIED" operation="mkdir" profile=
"""
Running:
$ sudo apparmor_parser --skip-cache -r /etc/apparmor.
fixes it.
This strongly indicates that the cache has the old content and did not get re-generated on upgrade or image build.
I also managed to reproduce this via:
15.04/stable-
The image is here: https:/
Related branches
- Ricardo Salveti (community): Needs Information
-
Diff: 157 lines (+78/-6)5 files modifiedhelpers/helpers.go (+17/-0)
helpers/helpers_test.go (+11/-1)
snappy/dirs.go (+4/-0)
snappy/systemimage.go (+16/-5)
snappy/systemimage_test.go (+30/-0)
- Sergio Schvezov (community): Approve
- Ubuntu branches: Pending requested
-
Diff: 94 lines (+59/-0)5 files modifieddebian/changelog (+19/-0)
debian/install (+1/-0)
debian/links (+1/-0)
lib/systemd/system/snappy-workaround-apparmor.service (+11/-0)
usr/bin/snappy-apparmor-lp1460152 (+27/-0)
description: | updated |
description: | updated |
description: | updated |
description: | updated |
summary: |
- (sometimes?) becomes confused about apparmor rules for ubuntu-core- - launcher + apparmor cache not updated when apparmor.d rules change |
Changed in snappy: | |
importance: | Undecided → Critical |
summary: |
- apparmor cache not updated when apparmor.d rules change + apparmor cache not updated when apparmor.d rules change (breaks + 15.04/stable -> 15.04/edge updates) |
Changed in snappy: | |
status: | New → In Progress |
tags: | added: patch |
Changed in snappy: | |
assignee: | nobody → Michael Vogt (mvo) |
Changed in snappy: | |
status: | In Progress → Fix Committed |
Changed in snappy: | |
status: | Fix Committed → Fix Released |
Changed in apparmor (Ubuntu): | |
status: | New → Fix Released |
<jdstrand> rsalveti: I'm only putting this out there as an option that you are free to ignore-- there are only 3 system profiles on core. pregenerated them doesn't buy us much on first boot-- about 2.2 seconds on bbb d/cache/ * d/cache is in /etc/system- image/writable- paths d/cache/ *
<jdstrand> rsalveti: maybe on upgrade hook could simply rm -f /etc/apparmor.
<jdstrand> rsalveti: could the a/b partitioning be getting in the way?
<jdstrand> rsalveti: ie, are the writable bind mounted areas a/b'd as well?
<rsalveti> that's an interesting question
* ogra_ thought not
<ogra_> we only have one writable and a and b
<jdstrand> rsalveti: eg, if a has old cache and old profile and we reboot into b with new profile, do we get a's old cache file?
<rsalveti> yeah, are we sharing the same writable path for the cache?
<rsalveti> if so, then, hmm
<ogra_> most likely
<rsalveti> not good
<ogra_> since we only have one writable partition
<rsalveti> ogra_: can you confirm?
<ogra_> yeah, i think i can
<ogra_> three partitions ... two readonly, one writable ...
<ogra_> writable gets mounted in initrd by label, no matter what readonly part is active
<ogra_> and /etc/apparmor.
<ogra_> i guess we would want an a/b scheme there
<ogra_> in a subdir or some such
<ogra_> or via a bind mount that hides the real path
<jdstrand> ok, so I'm much more convinced that for now, we rm -f /etc/apparmor.
<jdstrand> cause the alternative would be too risky for sru
<jdstrand> we need to implement the alternative for touch anyway
<jdstrand> s/touch/personal/
<rsalveti> ogra_: jdstrand: yeah, let's just do this
<rsalveti> sharing same writable path can be indeed dangerous
<rsalveti> it's usually desirable
<rsalveti> but we need to be careful