apparmor: ensure that undecidable profile attachments fail
authorJohn Johansen <john.johansen@canonical.com>
Sat, 18 Nov 2017 01:42:42 +0000 (17:42 -0800)
committerJohn Johansen <john.johansen@canonical.com>
Tue, 21 Nov 2017 10:17:14 +0000 (02:17 -0800)
commit844b8292b6311ecd30ae63db1471edb26e01d895
tree9c0993f64ff7eeaf3144a5063a4fb562c36c2f48
parent4633307e5ed6128975595df43f796a10c41d11c1
apparmor: ensure that undecidable profile attachments fail

Profiles that have an undecidable overlap in their attachments are
being incorrectly handled. Instead of failing to attach the first one
encountered is being used.

eg.
  profile A /** { .. }
  profile B /*foo { .. }

have an unresolvable longest left attachment, they both have an exact
match on / and then have an overlapping expression that has no clear
winner.

Currently the winner will be the profile that is loaded first which
can result in non-deterministic behavior. Instead in this situation
the exec should fail.

Fixes: 898127c34ec0 ("AppArmor: functions for domain transitions")
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/domain.c