aboutsummaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2015-01-09 07:32:47 -0800
committerRuchi Kandoi <kandoiruchi@google.com>2015-02-04 15:20:12 -0800
commit96f8bcf4a3984181282d099d2f477a0139157270 (patch)
treebcf5d52230a4323d2f568699d77595addc7eb7a9 /security
parentd9aff13a00a7bacde89c8fa907df8c1801693af5 (diff)
pstore: selinux: add security in-core xattr support for pstore and debugfs
- add "pstore" and "debugfs" to list of in-core exceptions - change fstype checks to boolean equation - change from strncmp to strcmp for checking Signed-off-by: Mark Salyzyn <salyzyn@android.com> Bug: 18917345 Bug: 18935184 Change-Id: Ib648f30ce4b5d6c96f11465836d6fee89bec1c72
Diffstat (limited to 'security')
-rw-r--r--security/selinux/hooks.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index ecb308359a99..524bb4eebc30 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -403,23 +403,14 @@ static int selinux_is_sblabel_mnt(struct super_block *sb)
{
struct superblock_security_struct *sbsec = sb->s_security;
- if (sbsec->behavior == SECURITY_FS_USE_XATTR ||
- sbsec->behavior == SECURITY_FS_USE_TRANS ||
- sbsec->behavior == SECURITY_FS_USE_TASK)
- return 1;
-
- /* Special handling for sysfs. Is genfs but also has setxattr handler*/
- if (strncmp(sb->s_type->name, "sysfs", sizeof("sysfs")) == 0)
- return 1;
-
- /*
- * Special handling for rootfs. Is genfs but supports
- * setting SELinux context on in-core inodes.
- */
- if (strncmp(sb->s_type->name, "rootfs", sizeof("rootfs")) == 0)
- return 1;
-
- return 0;
+ return sbsec->behavior == SECURITY_FS_USE_XATTR ||
+ sbsec->behavior == SECURITY_FS_USE_TRANS ||
+ sbsec->behavior == SECURITY_FS_USE_TASK ||
+ /* Special handling. Genfs but also in-core setxattr handler */
+ !strcmp(sb->s_type->name, "sysfs") ||
+ !strcmp(sb->s_type->name, "pstore") ||
+ !strcmp(sb->s_type->name, "debugfs") ||
+ !strcmp(sb->s_type->name, "rootfs");
}
static int sb_finish_set_opts(struct super_block *sb)
@@ -467,13 +458,6 @@ static int sb_finish_set_opts(struct super_block *sb)
if (selinux_is_sblabel_mnt(sb))
sbsec->flags |= SBLABEL_MNT;
- /*
- * Special handling for rootfs. Is genfs but supports
- * setting SELinux context on in-core inodes.
- */
- if (strncmp(sb->s_type->name, "rootfs", sizeof("rootfs")) == 0)
- sbsec->flags |= SE_SBLABELSUPP;
-
/* Initialize the root inode. */
rc = inode_doinit_with_dentry(root_inode, root);