Loading init/devices.cpp +7 −2 Original line number Original line Diff line number Diff line Loading @@ -251,7 +251,10 @@ static void make_device(const char *path, * some device nodes, so the uid has to be set with chown() and is still * some device nodes, so the uid has to be set with chown() and is still * racy. Fixing the gid race at least fixed the issue with system_server * racy. Fixing the gid race at least fixed the issue with system_server * opening dynamic input devices under the AID_INPUT gid. */ * opening dynamic input devices under the AID_INPUT gid. */ setegid(gid); if (setegid(gid)) { PLOG(ERROR) << "setegid(" << gid << ") for " << path << " device failed"; goto out; } /* If the node already exists update its SELinux label to handle cases when /* If the node already exists update its SELinux label to handle cases when * it was created with the wrong context during coldboot procedure. */ * it was created with the wrong context during coldboot procedure. */ if (mknod(path, mode, dev) && (errno == EEXIST) && secontext) { if (mknod(path, mode, dev) && (errno == EEXIST) && secontext) { Loading @@ -273,7 +276,9 @@ static void make_device(const char *path, out: out: chown(path, uid, -1); chown(path, uid, -1); setegid(AID_ROOT); if (setegid(AID_ROOT)) { PLOG(FATAL) << "setegid(AID_ROOT) failed"; } if (secontext) { if (secontext) { freecon(secontext); freecon(secontext); Loading Loading
init/devices.cpp +7 −2 Original line number Original line Diff line number Diff line Loading @@ -251,7 +251,10 @@ static void make_device(const char *path, * some device nodes, so the uid has to be set with chown() and is still * some device nodes, so the uid has to be set with chown() and is still * racy. Fixing the gid race at least fixed the issue with system_server * racy. Fixing the gid race at least fixed the issue with system_server * opening dynamic input devices under the AID_INPUT gid. */ * opening dynamic input devices under the AID_INPUT gid. */ setegid(gid); if (setegid(gid)) { PLOG(ERROR) << "setegid(" << gid << ") for " << path << " device failed"; goto out; } /* If the node already exists update its SELinux label to handle cases when /* If the node already exists update its SELinux label to handle cases when * it was created with the wrong context during coldboot procedure. */ * it was created with the wrong context during coldboot procedure. */ if (mknod(path, mode, dev) && (errno == EEXIST) && secontext) { if (mknod(path, mode, dev) && (errno == EEXIST) && secontext) { Loading @@ -273,7 +276,9 @@ static void make_device(const char *path, out: out: chown(path, uid, -1); chown(path, uid, -1); setegid(AID_ROOT); if (setegid(AID_ROOT)) { PLOG(FATAL) << "setegid(AID_ROOT) failed"; } if (secontext) { if (secontext) { freecon(secontext); freecon(secontext); Loading