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

Showing 1-6 of 6 messages
Kernel porting ERRORs Failed setting process group of NNN to 0/1; add_tid_to_cgroup failed failuch 8/10/12 2:46 AM
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
    Re: Kernel porting ERRORs Failed setting process group of NNN to 0/1; add_tid_to_cgroup failed Glenn Kasten 8/13/12 9:44 AM
    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. 
    Re: Kernel porting ERRORs Failed setting process group of NNN to 0/1; add_tid_to_cgroup failed John Tapsell 10/3/12 2:10 PM
    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
    Re: Kernel porting ERRORs Failed setting process group of NNN to 0/1; add_tid_to_cgroup failed Glenn Kasten 10/5/12 9:14 AM
    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.
    Re: Kernel porting ERRORs Failed setting process group of NNN to 0/1; add_tid_to_cgroup failed John Tapsell 10/8/12 5:56 AM
    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
    Re: Kernel porting ERRORs Failed setting process group of NNN to 0/1; add_tid_to_cgroup failed Glenn Kasten 10/11/12 6:08 PM
    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.