[PATCH} ngroups, list of groups to /proc/#/status

Topi Miettinen (Topi.Miettinen@medialab.sonera.net)
Sun, 22 Nov 1998 17:35:28 +0200


This simple patch adds the count and listing of supplementary groups to
/proc/#/status, perhaps for security auditing purposes. Is there currently
any other way of looking at these outside of the running process?

-Topi

diff -ru linux-2.1.125/fs/proc/array.c.orig linux-2.1.125/fs/proc/array.c
--- fs/proc/array.c.orig Sat Nov 7 17:04:56 1998
+++ fs/proc/array.c Sun Nov 22 17:02:48 1998
@@ -696,16 +696,25 @@

static inline char * task_state(struct task_struct *p, char *buffer)
{
+ int g;
+
buffer += sprintf(buffer,
"State:\t%s\n"
"Pid:\t%d\n"
"PPid:\t%d\n"
"Uid:\t%d\t%d\t%d\t%d\n"
- "Gid:\t%d\t%d\t%d\t%d\n",
+ "Gid:\t%d\t%d\t%d\t%d\n"
+ "NGroups:\t%d\n"
+ "Groups:\t",
get_task_state(p),
p->pid, p->p_pptr->pid,
p->uid, p->euid, p->suid, p->fsuid,
- p->gid, p->egid, p->sgid, p->fsgid);
+ p->gid, p->egid, p->sgid, p->fsgid,
+ p->ngroups);
+ for (g = 0; g < p->ngroups; g++) {
+ buffer += sprintf(buffer, "%d ", p->groups[g]);
+ }
+ buffer += sprintf(buffer, "\n");
return buffer;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/