odroid-linux/security/tomoyo
Tetsuo Handa d5748309bb TOMOYO: Fix mount flags checking order.
commit df91e49477 upstream.

Userspace can pass in arbitrary combinations of MS_* flags to mount().

If both MS_BIND and one of MS_SHARED/MS_PRIVATE/MS_SLAVE/MS_UNBINDABLE are
passed, device name which should be checked for MS_BIND was not checked because
MS_SHARED/MS_PRIVATE/MS_SLAVE/MS_UNBINDABLE had higher priority than MS_BIND.

If both one of MS_BIND/MS_MOVE and MS_REMOUNT are passed, device name which
should not be checked for MS_REMOUNT was checked because MS_BIND/MS_MOVE had
higher priority than MS_REMOUNT.

Fix these bugs by changing priority to MS_REMOUNT -> MS_BIND ->
MS_SHARED/MS_PRIVATE/MS_SLAVE/MS_UNBINDABLE -> MS_MOVE as with do_mount() does.

Also, unconditionally return -EINVAL if more than one of
MS_SHARED/MS_PRIVATE/MS_SLAVE/MS_UNBINDABLE is passed so that TOMOYO will not
generate inaccurate audit logs, for commit 7a2e8a8f "VFS: Sanity check mount
flags passed to change_mnt_propagation()" clarified that these flags must be
exclusively passed.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-13 08:14:08 -07:00
..
common.c TOMOYO: Fix infinite loop bug when reading /sys/kernel/security/tomoyo/audit 2011-04-19 09:37:12 +10:00
common.h TOMOYO: Don't abuse sys_getpid(), sys_getppid() 2010-09-27 10:53:18 +10:00
domain.c TOMOYO: Use pathname specified by policy rather than execve() 2010-08-02 15:38:38 +10:00
file.c TOMOYO: Don't add / for allow_unmount permission check. 2011-04-19 09:37:09 +10:00
gc.c TOMOYO: Rename symbols. 2010-08-02 15:34:54 +10:00
group.c TOMOYO: Use pathname specified by policy rather than execve() 2010-08-02 15:38:38 +10:00
Kconfig Kconfig and Makefile 2009-02-12 15:19:00 +11:00
load_policy.c Fix common misspellings 2011-03-31 11:26:23 -03:00
Makefile TOMOYO: Merge path_group and number_group. 2010-08-02 15:34:42 +10:00
memory.c tomoyo: fix memory leak in tomoyo_commit_ok() 2011-03-31 10:25:06 +11:00
mount.c TOMOYO: Fix mount flags checking order. 2012-04-13 08:14:08 -07:00
realpath.c fix apparmor dereferencing potentially freed dentry, sanitize __d_path() API 2011-12-21 12:57:36 -08:00
securityfs_if.c TOMOYO: Explicitly set file_operations->llseek pointer. 2010-08-02 15:34:57 +10:00
tomoyo.c TOMOYO: Rename symbols. 2010-08-02 15:34:33 +10:00
util.c TOMOYO: Fix wrong domainname validation. 2011-05-12 11:07:21 +10:00