Enable proc fs to print more than 32 groups entries
authorYan Yin <yan.yin@intel.com>
Tue, 21 Feb 2012 09:23:26 +0000 (17:23 +0800)
committerYin Kangkai <kangkai.yin@linux.intel.com>
Thu, 26 Dec 2013 14:33:54 +0000 (22:33 +0800)
from security-server-0.0.1/include/SLP_security-server_PG.h:

"In kernel version 2.6, there is a file in proc file system
"/proc/[pid]/status" which describes various information about the
process as text, it has a line named "Groups:" and it lists the group
IDs that the process is belonged to. B
ut there is a drawback in this file, it only shows at most 32 group IDs,
if number of groups of the process is bigger than 32, it ignores
them.
To enable to show all the groups you have to patch the kernel source
code to show more groups than 32, but there is another drawback. All
files in the proc file system has size limit to 4k bytes because the
file buffer size is 4k bytes, so it's not possible to show all possible
groups of the process(64k), but currently number of all groups in the
LiMo platform is much lower than the size, so it's not a big problem.
But near future we need to apply this patch into kernel mainline source
code by any form.

fs/proc/array.c

index f9bd395..d0ae725 100644 (file)
@@ -204,7 +204,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
        group_info = cred->group_info;
        task_unlock(p);
 
-       for (g = 0; g < min(group_info->ngroups, NGROUPS_SMALL); g++)
+       for (g = 0; g < group_info->ngroups; g++)
                seq_printf(m, "%d ", GROUP_AT(group_info, g));
        put_cred(cred);