summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorStephen Smalley <sds@tycho.nsa.gov>2013-04-03 13:15:01 -0400
committerWilliam Roberts <w.roberts@sta.samsung.com>2013-04-03 17:44:19 -0700
commit5f7b017f41b5bd0b86b5078b17c41ef7bc201c8d (patch)
treefe98438fdbfb973738b4959f0939e4e2baac9206 /init
parentf5562cb66c1c15d65bc372ede4c180430e1ce9d7 (diff)
downloadsystem_core-5f7b017f41b5bd0b86b5078b17c41ef7bc201c8d.zip
system_core-5f7b017f41b5bd0b86b5078b17c41ef7bc201c8d.tar.gz
system_core-5f7b017f41b5bd0b86b5078b17c41ef7bc201c8d.tar.bz2
Update ueventd set the SELinux context on sysfs
This change enables labeling of dynamically created sysfs nodes with specific SELinux security contexts. Change-Id: If8b8d66120453123c1371ce063b6f20e8b96b6ef Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Diffstat (limited to 'init')
-rw-r--r--init/devices.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/init/devices.c b/init/devices.c
index e25034c..69f5fc8 100644
--- a/init/devices.c
+++ b/init/devices.c
@@ -127,6 +127,7 @@ void fixup_sys_perms(const char *upath)
char buf[512];
struct listnode *node;
struct perms_ *dp;
+ char *secontext;
/* upaths omit the "/sys" that paths in this list
* contain, so we add 4 when comparing...
@@ -148,6 +149,14 @@ void fixup_sys_perms(const char *upath)
INFO("fixup %s %d %d 0%o\n", buf, dp->uid, dp->gid, dp->perm);
chown(buf, dp->uid, dp->gid);
chmod(buf, dp->perm);
+ if (sehandle) {
+ secontext = NULL;
+ selabel_lookup(sehandle, &secontext, buf, 0);
+ if (secontext) {
+ setfilecon(buf, secontext);
+ freecon(secontext);
+ }
+ }
}
}