Skip to content

Commit

Permalink
SELinux: fix array out of bounds when mounting with selinux options
Browse files Browse the repository at this point in the history
Given an illegal selinux option it was possible for match_token to work in
random memory at the end of the match_table_t array.

Note that privilege is required to perform a context mount, so this issue is
effectively limited to root only.

Signed-off-by: Eric Paris <[email protected]>
Acked-by: Stephen Smalley <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
eparis authored and James Morris committed Sep 19, 2007
1 parent a88a8ef commit 31e8793
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ static inline int inode_doinit(struct inode *inode)
}

enum {
Opt_error = -1,
Opt_context = 1,
Opt_fscontext = 2,
Opt_defcontext = 4,
Expand All @@ -327,6 +328,7 @@ static match_table_t tokens = {
{Opt_fscontext, "fscontext=%s"},
{Opt_defcontext, "defcontext=%s"},
{Opt_rootcontext, "rootcontext=%s"},
{Opt_error, NULL},
};

#define SEL_MOUNT_FAIL_MSG "SELinux: duplicate or incompatible mount options\n"
Expand Down

0 comments on commit 31e8793

Please sign in to comment.