aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorStephen Smalley <sds@tycho.nsa.gov>2015-05-20 12:33:16 -0400
committerZiyan <jaraidaniel@gmail.com>2016-03-11 16:02:38 +0100
commit190a5ce79c29cb717de99d061e10012c999c1211 (patch)
treea2f9b5987aced8b7180084fa34e38978d2eb3563 /security
parentf9a20712a33869c2f3c7dbae01de003b42b77fef (diff)
downloadkernel_samsung_espresso10-190a5ce79c29cb717de99d061e10012c999c1211.zip
kernel_samsung_espresso10-190a5ce79c29cb717de99d061e10012c999c1211.tar.gz
kernel_samsung_espresso10-190a5ce79c29cb717de99d061e10012c999c1211.tar.bz2
selinux: enable genfscon labeling for sysfs and pstore files
Support per-file labeling of sysfs and pstore files based on genfscon policy entries. This is safe because the sysfs and pstore directory tree cannot be manipulated by userspace, except to unlink pstore entries. This provides an alternative method of assigning per-file labeling to sysfs or pstore files without needing to set the labels from userspace on each boot. The advantages of this approach are that the labels are assigned as soon as the dentry is first instantiated and userspace does not need to walk the sysfs or pstore tree and set the labels on each boot. The limitations of this approach are that the labels can only be assigned based on pathname prefix matching. You can initially assign labels using this mechanism and then change them at runtime via setxattr if allowed to do so by policy. Change-Id: If5999785fdc1d24d869b23ae35cd302311e94562 Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov> Suggested-by: Dominick Grift <dac.override@gmail.com>
Diffstat (limited to 'security')
-rw-r--r--security/selinux/hooks.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index e10b545..89a4c5e 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -690,7 +690,9 @@ static int selinux_set_mnt_opts(struct super_block *sb,
if (strcmp(sb->s_type->name, "proc") == 0)
sbsec->flags |= SE_SBPROC | SE_SBGENFS;
- if (strcmp(sb->s_type->name, "debugfs") == 0)
+ if (!strcmp(sb->s_type->name, "debugfs") ||
+ !strcmp(sb->s_type->name, "sysfs") ||
+ !strcmp(sb->s_type->name, "pstore"))
sbsec->flags |= SE_SBGENFS;
/* Determine the labeling behavior to use for this filesystem type. */