AppArmor: Fix underflow in xindex calculation
authorJohn Johansen <john.johansen@canonical.com>
Wed, 22 Feb 2012 08:32:30 +0000 (00:32 -0800)
committerJohn Johansen <john.johansen@canonical.com>
Mon, 27 Feb 2012 19:38:21 +0000 (11:38 -0800)
commit8b964eae204d791421677ec56b94a7b18cf8740d
tree7c1a7b5b6be9f2d9b60d8cba1094635d3f74466c
parentade3ddc01e2e426cc24c744be85dcaad4e8f8aba
AppArmor: Fix underflow in xindex calculation

If the xindex value stored in the accept tables is 0, the extraction of
that value will result in an underflow (0 - 4).

In properly compiled policy this should not happen for file rules but
it may be possible for other rule types in the future.

To exploit this underflow a user would have to be able to load a corrupt
policy, which requires CAP_MAC_ADMIN, overwrite system policy in kernel
memory or know of a compiler error resulting in the flaw being present
for loaded policy (no such flaw is known at this time).

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Kees Cook <kees@ubuntu.com>
security/apparmor/include/file.h