From 9d66fa0460a29800ef8d273e84b2510df03c55b6 Mon Sep 17 00:00:00 2001 From: "Torne (Richard Coles)" Date: Mon, 19 Mar 2018 17:47:06 -0400 Subject: [PATCH] Don't try to create a process group when not root. The WebView zygote doesn't run with uid 0 and so can't create a process group, since the directory in the cgroupfs is only writable by root. Skip this when the zygote isn't running with uid 0 to avoid the error being printed, as this causes misattribution of bugs. Bug: 62435375 Test: use WebView, check log Change-Id: I50164bba5ac7587933d58ca0595336ba4fe33728 --- core/jni/com_android_internal_os_Zygote.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp index 7c8a52d1432bf..b5fd7929eeae9 100644 --- a/core/jni/com_android_internal_os_Zygote.cpp +++ b/core/jni/com_android_internal_os_Zygote.cpp @@ -666,7 +666,9 @@ static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArra } } - if (!is_system_server) { + // If this zygote isn't root, it won't be able to create a process group, + // since the directory is owned by root. + if (!is_system_server && getuid() == 0) { int rc = createProcessGroup(uid, getpid()); if (rc != 0) { if (rc == -EROFS) {