Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d9d171e authored by T.J. Mercier's avatar T.J. Mercier
Browse files

libprocessgroup: Check validity of uid and pid arguments for createProcessGroup

killProcessGroup already checks for validity of the uid and pid input
arguments. Also add this checking to createProcessGroup.

Bug: 333261173
Change-Id: Ie74b9c2716978cb5eb434af12e27945e29af876e
parent 29e30f25
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -695,6 +695,15 @@ static int createProcessGroupInternal(uid_t uid, pid_t initialPid, std::string c
}

int createProcessGroup(uid_t uid, pid_t initialPid, bool memControl) {
    if (uid < 0) {
        LOG(ERROR) << __func__ << ": invalid UID " << uid;
        return -1;
    }
    if (initialPid <= 0) {
        LOG(ERROR) << __func__ << ": invalid PID " << initialPid;
        return -1;
    }

    if (memControl && !UsePerAppMemcg()) {
        LOG(ERROR) << "service memory controls are used without per-process memory cgroup support";
        return -EINVAL;