Merge "init: Put init in group AID_READPROC" am: 995560919c
am: ba2a810deb
Change-Id: Id46e8132118a0c07ba3db362318c2709e48ceddd
This commit is contained in:
commit
041a72ab30
2 changed files with 4 additions and 4 deletions
|
|
@ -585,6 +585,8 @@ int main(int argc, char** argv) {
|
||||||
mount("devpts", "/dev/pts", "devpts", 0, NULL);
|
mount("devpts", "/dev/pts", "devpts", 0, NULL);
|
||||||
#define MAKE_STR(x) __STRING(x)
|
#define MAKE_STR(x) __STRING(x)
|
||||||
mount("proc", "/proc", "proc", 0, "hidepid=2,gid=" MAKE_STR(AID_READPROC));
|
mount("proc", "/proc", "proc", 0, "hidepid=2,gid=" MAKE_STR(AID_READPROC));
|
||||||
|
gid_t groups[] = { AID_READPROC };
|
||||||
|
setgroups(arraysize(groups), groups);
|
||||||
mount("sysfs", "/sys", "sysfs", 0, NULL);
|
mount("sysfs", "/sys", "sysfs", 0, NULL);
|
||||||
mount("selinuxfs", "/sys/fs/selinux", "selinuxfs", 0, NULL);
|
mount("selinuxfs", "/sys/fs/selinux", "selinuxfs", 0, NULL);
|
||||||
mknod("/dev/kmsg", S_IFCHR | 0600, makedev(1, 11));
|
mknod("/dev/kmsg", S_IFCHR | 0600, makedev(1, 11));
|
||||||
|
|
|
||||||
|
|
@ -233,10 +233,8 @@ void Service::SetProcessAttributes() {
|
||||||
PLOG(FATAL) << "setgid failed for " << name_;
|
PLOG(FATAL) << "setgid failed for " << name_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!supp_gids_.empty()) {
|
if (setgroups(supp_gids_.size(), &supp_gids_[0]) != 0) {
|
||||||
if (setgroups(supp_gids_.size(), &supp_gids_[0]) != 0) {
|
PLOG(FATAL) << "setgroups failed for " << name_;
|
||||||
PLOG(FATAL) << "setgroups failed for " << name_;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (uid_) {
|
if (uid_) {
|
||||||
if (setuid(uid_) != 0) {
|
if (setuid(uid_) != 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue