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

Commit b27d4a2a authored by Automerger Merge Worker's avatar Automerger Merge Worker Committed by Android (Google) Code Review
Browse files

Merge "Merge "Treat process group creation failure due to a dead process as...

Merge "Merge "Treat process group creation failure due to a dead process as non-fatal" am: 03dfa27d am: 97735895 am: 087c3f92 am: 931bdd37 am: 37075911"
parents 5b8b4cf6 62f109ed
Loading
Loading
Loading
Loading
+9 −4
Original line number Original line Diff line number Diff line
@@ -1805,12 +1805,17 @@ static void SpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray gids,
    if (!is_system_server && getuid() == 0) {
    if (!is_system_server && getuid() == 0) {
        const int rc = createProcessGroup(uid, getpid());
        const int rc = createProcessGroup(uid, getpid());
        if (rc != 0) {
        if (rc != 0) {
            if (rc == -ESRCH) {
                // If process is dead, treat this as a non-fatal error
                ALOGE("createProcessGroup(%d, %d) failed: %s", uid, /* pid= */ 0, strerror(-rc));
            } else {
                fail_fn(rc == -EROFS ? CREATE_ERROR("createProcessGroup failed, kernel missing "
                fail_fn(rc == -EROFS ? CREATE_ERROR("createProcessGroup failed, kernel missing "
                                                    "CONFIG_CGROUP_CPUACCT?")
                                                    "CONFIG_CGROUP_CPUACCT?")
                                     : CREATE_ERROR("createProcessGroup(%d, %d) failed: %s", uid,
                                     : CREATE_ERROR("createProcessGroup(%d, %d) failed: %s", uid,
                                                    /* pid= */ 0, strerror(-rc)));
                                                    /* pid= */ 0, strerror(-rc)));
            }
            }
        }
        }
    }


    SetGids(env, gids, is_child_zygote, fail_fn);
    SetGids(env, gids, is_child_zygote, fail_fn);
    SetRLimits(env, rlimits, fail_fn);
    SetRLimits(env, rlimits, fail_fn);