summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorStephen Smalley <sds@tycho.nsa.gov>2014-06-12 12:29:14 -0400
committerStephen Smalley <sds@tycho.nsa.gov>2014-06-16 09:44:30 -0400
commitb4c5200f51c3568f604a4557119ab545a6ddac94 (patch)
treef96495cf145084fad206f936f09a9f3963af037d /init
parent7fa1cd19638c8ada0786e03abe50b5fe9b9f4270 (diff)
downloadsystem_core-b4c5200f51c3568f604a4557119ab545a6ddac94.tar.gz
system_core-b4c5200f51c3568f604a4557119ab545a6ddac94.tar.bz2
system_core-b4c5200f51c3568f604a4557119ab545a6ddac94.zip
Extend ueventd to use the label-by-symlink support in libselinux.
When ueventd creates a device node, it may also create one or more symlinks to the device node. These symlinks may be the only stable name for the device, e.g. if the partition is dynamically assigned. A corresponding change with the same Change-Id to external/libselinux introduces selabel_lookup_best_match() to support looking up the "best match" for a device node based on its real path (key) and any links to it (aliases). This change updates ueventd to use this new interface to find the best match for the device node when creating it. Change-Id: Id6c2597eee2b6723a5089dcf7c450f8d0a4128f4 Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Diffstat (limited to 'init')
-rw-r--r--init/devices.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/init/devices.c b/init/devices.c
index 3119e8eca..02698eff1 100644
--- a/init/devices.c
+++ b/init/devices.c
@@ -196,7 +196,8 @@ static mode_t get_device_perm(const char *path, unsigned *uid, unsigned *gid)
static void make_device(const char *path,
const char *upath UNUSED,
- int block, int major, int minor)
+ int block, int major, int minor,
+ const char **links)
{
unsigned uid;
unsigned gid;
@@ -207,7 +208,7 @@ static void make_device(const char *path,
mode = get_device_perm(path, &uid, &gid) | (block ? S_IFBLK : S_IFCHR);
if (sehandle) {
- selabel_lookup(sehandle, &secontext, path, mode);
+ selabel_lookup_best_match(sehandle, &secontext, path, links, mode);
setfscreatecon(secontext);
}
@@ -523,7 +524,7 @@ static void handle_device(const char *action, const char *devpath,
int i;
if(!strcmp(action, "add")) {
- make_device(devpath, path, block, major, minor);
+ make_device(devpath, path, block, major, minor, (const char **)links);
if (links) {
for (i = 0; links[i]; i++)
make_link(devpath, links[i]);