Merge "libprocessgroup: Check validity of uid and pid arguments" am: c1798def91
am: f5d65bf11c
am: 92824d9d04
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2475605 Change-Id: I245c9c521391386acee8c16dcb15d5cc08edb06e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
9cff13459f
1 changed files with 6 additions and 9 deletions
|
@ -451,14 +451,9 @@ static int DoKillProcessGroupOnce(const char* cgroup, uid_t uid, int initialPid,
|
|||
|
||||
static int KillProcessGroup(uid_t uid, int initialPid, int signal, int retries,
|
||||
int* max_processes) {
|
||||
if (uid < 0) {
|
||||
LOG(ERROR) << __func__ << ": invalid UID " << uid;
|
||||
return -1;
|
||||
}
|
||||
if (initialPid <= 0) {
|
||||
LOG(ERROR) << __func__ << ": invalid PID " << initialPid;
|
||||
return -1;
|
||||
}
|
||||
CHECK_GE(uid, 0);
|
||||
CHECK_GT(initialPid, 0);
|
||||
|
||||
std::string hierarchy_root_path;
|
||||
if (CgroupsAvailable()) {
|
||||
CgroupGetControllerPath(CGROUPV2_CONTROLLER_NAME, &hierarchy_root_path);
|
||||
|
@ -595,7 +590,8 @@ static int createProcessGroupInternal(uid_t uid, int initialPid, std::string cgr
|
|||
}
|
||||
|
||||
int createProcessGroup(uid_t uid, int initialPid, bool memControl) {
|
||||
std::string cgroup;
|
||||
CHECK_GE(uid, 0);
|
||||
CHECK_GT(initialPid, 0);
|
||||
|
||||
if (memControl && !UsePerAppMemcg()) {
|
||||
PLOG(ERROR) << "service memory controls are used without per-process memory cgroup support";
|
||||
|
@ -613,6 +609,7 @@ int createProcessGroup(uid_t uid, int initialPid, bool memControl) {
|
|||
}
|
||||
}
|
||||
|
||||
std::string cgroup;
|
||||
CgroupGetControllerPath(CGROUPV2_CONTROLLER_NAME, &cgroup);
|
||||
return createProcessGroupInternal(uid, initialPid, cgroup, true);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue