Loading init/devices.cpp +15 −6 Original line number Diff line number Diff line Loading @@ -244,7 +244,11 @@ static void make_device(const char *path, mode = get_device_perm(path, links, &uid, &gid) | (block ? S_IFBLK : S_IFCHR); selabel_lookup_best_match(sehandle, &secontext, path, links, mode); if (selabel_lookup_best_match(sehandle, &secontext, path, links, mode)) { ERROR("Device '%s' not created; cannot find SELinux label (%s)\n", path, strerror(errno)); return; } setfscreatecon(secontext); dev = makedev(major, minor); Loading @@ -254,15 +258,20 @@ static void make_device(const char *path, * racy. Fixing the gid race at least fixed the issue with system_server * opening dynamic input devices under the AID_INPUT gid. */ setegid(gid); mknod(path, mode, dev); /* If the node already exists update its SELinux label to handle cases when * it was created with the wrong context during coldboot procedure. */ if (mknod(path, mode, dev) && (errno == EEXIST)) { if (lsetfilecon(path, secontext)) { ERROR("Cannot set '%s' SELinux label on '%s' device (%s)\n", secontext, path, strerror(errno)); } } chown(path, uid, -1); setegid(AID_ROOT); if (secontext) { freecon(secontext); setfscreatecon(NULL); } } static void add_platform_device(const char *path) { Loading Loading
init/devices.cpp +15 −6 Original line number Diff line number Diff line Loading @@ -244,7 +244,11 @@ static void make_device(const char *path, mode = get_device_perm(path, links, &uid, &gid) | (block ? S_IFBLK : S_IFCHR); selabel_lookup_best_match(sehandle, &secontext, path, links, mode); if (selabel_lookup_best_match(sehandle, &secontext, path, links, mode)) { ERROR("Device '%s' not created; cannot find SELinux label (%s)\n", path, strerror(errno)); return; } setfscreatecon(secontext); dev = makedev(major, minor); Loading @@ -254,15 +258,20 @@ static void make_device(const char *path, * racy. Fixing the gid race at least fixed the issue with system_server * opening dynamic input devices under the AID_INPUT gid. */ setegid(gid); mknod(path, mode, dev); /* If the node already exists update its SELinux label to handle cases when * it was created with the wrong context during coldboot procedure. */ if (mknod(path, mode, dev) && (errno == EEXIST)) { if (lsetfilecon(path, secontext)) { ERROR("Cannot set '%s' SELinux label on '%s' device (%s)\n", secontext, path, strerror(errno)); } } chown(path, uid, -1); setegid(AID_ROOT); if (secontext) { freecon(secontext); setfscreatecon(NULL); } } static void add_platform_device(const char *path) { Loading