From f53a2a1039bc31fb357b7ad356446a7e071da64a Mon Sep 17 00:00:00 2001 From: Yan Yin Date: Tue, 21 Feb 2012 17:23:26 +0800 Subject: [PATCH] Enable proc fs to print more than 32 groups entries 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/proc/array.c b/fs/proc/array.c index f9bd395..d0ae725 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -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); -- 2.7.4