Kernel porting ERRORs Failed setting process group of NNN to 0/1; add_tid_to_cgroup failed

2,218 views
Skip to first unread message

failuch

unread,
Aug 10, 2012, 5:46:18 AM8/10/12
to android...@googlegroups.com
Hello all,

I saw that a lot of people encountered these error :

  • W/ActivityManager(  349): Failed setting process group of 4911 to 0
  • W/SchedPolicy(  349): add_tid_to_cgroup failed to write '4911' (Permission denie
  • d); background=1



And I was unable to find explanation/solution  for this problem, although

I have checked  cgroups are mounted and /dev/cpuctl/tasks exist

Can you please to comment ?


ThX

Glenn Kasten

unread,
Aug 13, 2012, 12:44:35 PM8/13/12
to android...@googlegroups.com
Sometimes this is caused by incorrect init.rc.  Make sure your init.rc has all of the latest changes from system/core/rootdir/init.rc especially if you have forked it.

You mentioned a "lot of people" have seen this .. were these on other external postings or bug reports? if so can you please supply a link to these, it will help diagnose to see the other reports. 

Glenn Kasten

unread,
Oct 5, 2012, 12:14:25 PM10/5/12
to android...@googlegroups.com
I suggest getting a stack trace at the time of log, to see what is happening.
For example at that ALOGE also log the tid and fd, and then do an abort() or *(char*) 0 = 0;
This will prevent the system from running of course, but a logcat during bootup should show why it's failing.


On Wednesday, October 3, 2012 2:10:48 PM UTC-7, John Tapsell wrote:
Hi Glenn,

  Can you give any more hints about what to look for in init.rc ?  The cgroups code is exactly the same in my init.rc

  I have:

> ls -l /dev/cpuctl/tasks

-rwxrwxrwx system   system          0 2000-01-01 00:23 tasks

Yet I still get:

W/SchedPolicy(  189): add_tid_to_cgroup failed to write '435' (Permission denied); background=0

etc.

Any ideas please?

John

John Tapsell

unread,
Oct 8, 2012, 8:56:34 AM10/8/12
to android...@googlegroups.com
Thanks for the help Glenn - I now have more details.

The process triggering the warning is system_server, and this is running as user "system".

It is trying to write the pid of various other processes (com.android.inputmethod.latin, com.android.phone. com.android.launcher, etc) into /dev/inputctl/tasks

But these other processes have a different uid (they run as user app_16, app_20, radio, etc)

So the kernel/cgroups.c  file does:

                if (cred->euid &&
                    cred->euid != tcred->uid &&
                    cred->euid != tcred->suid) {
                        rcu_read_unlock();
                        cgroup_unlock();
                        return -EACCES;
                }

It fails on the uid check, and returns an error.  (I put a printk here to confirm this, and confirm the difference in euid and uid)

Is system_server supposed to be running as user "system", and is it supposed to be trying to change the cgroup of process owned by another user?

Thanks,

John

Glenn Kasten

unread,
Oct 11, 2012, 9:08:53 PM10/11/12
to android...@googlegroups.com
Your version of the source code appears to be missing this commit

commit 4a12178d3dd5b06a215076c60dc7cb124d711373

    cgroup: Add generic cgroup subsystem permission checks

You may be looking at a branch which lacks Android patches.

Reply all
Reply to author
Forward
0 new messages