3389
|
|
|
Christian Boltz |
8 years ago
|
|
|
3388
|
|
|
Tyler Hicks |
8 years ago
|
|
|
3387
|
|
|
Christian Boltz |
8 years ago
|
|
|
3386
|
|
|
Christian Boltz |
8 years ago
|
|
|
3385
|
|
|
Christian Boltz |
8 years ago
|
|
|
3384
|
|
|
Christian Boltz |
8 years ago
|
|
|
3383
|
|
|
Christian Boltz |
8 years ago
|
|
|
3382
|
|
|
Christian Boltz |
8 years ago
|
|
|
3381
|
|
|
Christian Boltz |
8 years ago
|
|
|
3380
|
|
Prevent crash caused by serialize_profile_from_old_profile()
If a profile file contains multiple profiles and one of those profiles contains a rule managed by a *Ruleset class, serialize_profile_from_old_profile() crashes with an AttributeError.
This happens because profile_data / write_prof_data contain only one profile with its hats, which explodes if a file contains multiple profiles, as reported in lp#1528139
Fixing this would need lots of write_prof_data[hat] -> write_prof_data[profile][hat] changes (and of course also a change in the calling code) or, better option, a full rewrite of serialize_profile_from_old_profile().
Unfortunately I don't have the time to do the rewrite at the moment (I have other things on my TODO list), and changing write_prof_data[hat] -> write_prof_data[profile][hat] is something that might introduce more breakage, so I'm not too keen to do that.
Therefore this patch wraps the serialize_profile_from_old_profile() call in try/except. If it fails, the diff will include an error message and recommend to use 'View Changes b/w (C)lean profiles' instead, which is known to work.
Note: I know using an error message as 'newprofile' isn't an usual way to display an error message, but I found it more intuitive than displaying it as a warning (without $PAGER).
References: https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1528139
Acked-by: Seth Arnold <seth.arnold@canonical.com> for trunk and 2.10
|
Christian Boltz |
8 years ago
|
|
|
3379
|
|
|
Christian Boltz |
8 years ago
|
|
|
3378
|
|
|
Christian Boltz |
8 years ago
|
|
|
3377
|
|
|
Tyler Hicks |
8 years ago
|
|
|
3376
|
|
|
Tyler Hicks |
8 years ago
|
|
|
3375
|
|
|
Tyler Hicks |
8 years ago
|
|
|
3374
|
|
|
Christian Boltz |
8 years ago
|
|
|
3373
|
|
Remove pname to bin_name mapping in autodep()
If autodep() is called with a pname starting with / (which can happen for (N)amed exec depending on the user input), this pname is mapped to bin_name.
This might look like a good idea, however if the given pname doesn't exist as file on-disk, autodep() returns None instead of a (mostly empty) profile. (Reproducer: choose (N)amed, enter "/foo/bar")
Further down the road, this results in two things: a) the None result gets written as empty profile file (with only a "Last modified" line) b) a crash if someone chooses to add an abstraction to the None, because None doesn't support the delete_duplicates() method for obvious reasons ;-)
Unfortunately this patch also introduces a regression - aa-logprof now fails to follow the exec and doesn't ask about the log events for the exec target anymore. However this doesn't really matter because of a) - asking and saving to /dev/null vs. not asking isn't a real difference ;-)
Actually the patch slightly improves things - it creates a profile for the exec target, but only with the depmod() defaults (abstractions/base) and always in complain mode.
I'd prefer a patch that also creates a complete profile for the exec target, but that isn't as easy as fixing the issues mentioned above and therefore is something for a future fix. To avoid we forget it, I opened https://bugs.launchpad.net/apparmor/+bug/1545155
Note: 2.9 "only" writes an empty file and doesn't crash - but writing an empty profile is still an improvement.
Acked-by: Kshitij Gupta <kgupta8592@gmail.com> for trunk, 2.10 and 2.9
|
Christian Boltz |
8 years ago
|
|
|
3372
|
|
|
Christian Boltz |
8 years ago
|
|
|
3371
|
|
|
Christian Boltz |
8 years ago
|
|
|
3370
|
|
|
Tyler Hicks |
8 years ago
|
|
|