summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorT.J. Mercier <tjmercier@google.com>2024-04-18 16:00:11 +0000
committerT.J. Mercier <tjmercier@google.com>2024-04-18 16:17:48 +0000
commit29e30f25b4f1efd639182eff8b9e7c5a49cf0ae6 (patch)
tree9ac85612d378e044ed4d7ecd2cacd38cff820884
parent73c6f08f5ebe8a04c20d82d4d5375a5a2338ca11 (diff)
downloadcore-29e30f25b4f1efd639182eff8b9e7c5a49cf0ae6.tar.gz
Revert "libprocessgroup: Check validity of uid and pid arguments"
This reverts commit 5a3c3f7ccff322a5383fa8a1b6450480cf7fbab9. Don't SIGABRT for invalid requests. Bug: 333261173 Change-Id: If22244753b43529ed17c315b3732af371827e774
-rw-r--r--libprocessgroup/processgroup.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/libprocessgroup/processgroup.cpp b/libprocessgroup/processgroup.cpp
index 94d950209..7c555708e 100644
--- a/libprocessgroup/processgroup.cpp
+++ b/libprocessgroup/processgroup.cpp
@@ -528,8 +528,14 @@ static populated_status cgroupIsPopulated(int events_fd) {
static int KillProcessGroup(
uid_t uid, pid_t initialPid, int signal, bool once = false,
std::chrono::steady_clock::time_point until = std::chrono::steady_clock::now() + 2200ms) {
- CHECK_GE(uid, 0);
- CHECK_GT(initialPid, 0);
+ if (uid < 0) {
+ LOG(ERROR) << __func__ << ": invalid UID " << uid;
+ return -1;
+ }
+ if (initialPid <= 0) {
+ LOG(ERROR) << __func__ << ": invalid PID " << initialPid;
+ return -1;
+ }
// Always attempt to send a kill signal to at least the initialPid, at least once, regardless of
// whether its cgroup exists or not. This should only be necessary if a bug results in the
@@ -689,9 +695,6 @@ static int createProcessGroupInternal(uid_t uid, pid_t initialPid, std::string c
}
int createProcessGroup(uid_t uid, pid_t initialPid, bool memControl) {
- CHECK_GE(uid, 0);
- CHECK_GT(initialPid, 0);
-
if (memControl && !UsePerAppMemcg()) {
LOG(ERROR) << "service memory controls are used without per-process memory cgroup support";
return -EINVAL;