controllers: disallow attaching kthreadd or threads with flag 0x04000000 to cgroups on kernel > 3.4.0

Since kernel commit c4c27fbdda4e8ba87806c415b6d15266b07bce4b and
14a40ffccd6163bbcd1d6f32b28a88ffe6149fc6, disallow attaching kthreadd
or threads with flag 0x04000000 to cgroups.
(Thread flag 0x04000000 is representation of PF_THREAD_BOUND which
had been replaced with PF_NO_SETAFFINITY on kernel 3.9 and later.)

The following testcases in cgroup_fj_testcases.sh will encounter
"echo: write error: Invalid argument" error while attaching tasks to the cgroup.
function        1 1 1 1 1 3 1 1 1
function        1 1 1 1 1 3 2 1 1
function        1 1 1 1 1 3 4 1 1

Error messages as follows:
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 295: echo: write error: Invalid argument
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 497: 10571 Killed                  $TESTROOT/cgroup_fj_proc
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 497: 10573 Killed                  $TESTROOT/cgroup_fj_proc
cgroup_test_fj    1  TFAIL  :  ltpapicmd.c:190: case98(function 1 1 1 1 1 3 1 1 1)    FAIL
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 295: echo: write error: Invalid argument
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 497: 10624 Killed                  $TESTROOT/cgroup_fj_proc
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 497: 10626 Killed                  $TESTROOT/cgroup_fj_proc
cgroup_test_fj    1  TFAIL  :  ltpapicmd.c:190: case99(function 1 1 1 1 1 3 2 1 1)    FAIL
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 295: echo: write error: Invalid argument
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 497: 10677 Killed                  $TESTROOT/cgroup_fj_proc
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 497: 10679 Killed                  $TESTROOT/cgroup_fj_proc
cgroup_test_fj    1  TFAIL  :  ltpapicmd.c:190: case100(function        1 1 1 1 1 3 4 1 1)    FAIL

So, we kindly avoid to attach these threads in cgroup tests.

Signed-off-by: Li Jinyue <lijinyue@huawei.com>
Acked-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
1 file changed