Skip to content

Commit

Permalink
AppArmor: Fix underflow in xindex calculation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
John Johansen committed Feb 27, 2012
1 parent ade3ddc commit 8b964ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion security/apparmor/include/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static inline u16 dfa_map_xindex(u16 mask)
index |= AA_X_NAME;
} else if (old_index == 3) {
index |= AA_X_NAME | AA_X_CHILD;
} else {
} else if (old_index) {
index |= AA_X_TABLE;
index |= old_index - 4;
}
Expand Down

0 comments on commit 8b964ea

Please sign in to comment.