[SSI] openssi/kernel/kernel capability.c,1.7,1.8

Roger Tsang <[email protected]> Mon, 25 Oct 2010 04:48:40 +0000
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/kernel
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv32496/kernel

Modified Files:
      Tag: OPENSSI-FC
	capability.c 
Log Message:
VPROC:
- Fix race in capset_capabilities() calling cap_set_all() / cap_set_pg() without holding tasklist_lock. Memory corruption may occur if the race is lost.

 kernel/capability.c |    2 ++
 1 files changed, 2 insertions(+)


Index: capability.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/kernel/capability.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- capability.c	7 Aug 2007 03:06:14 -0000	1.7
+++ capability.c	25 Oct 2010 04:48:38 -0000	1.8
@@ -208,11 +208,13 @@
 {
 
 	if (pid < 0) {
+		read_lock(&tasklist_lock);
 		if (pid == -1)  /* all procs other than current and init */
 			cap_set_all(&effective, &inheritable, &permitted);
 
 		else            /* all procs in process group */
 			cap_set_pg(-pid, &effective, &inheritable, &permitted);
+		read_unlock(&tasklist_lock);
 	} else {
 		/* FIXME: do we need to have a write lock here..? */
 		target->cap_effective   = effective;


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev