Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Feb 2011 12:55:55 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 188776 for review
Message-ID:  <201102131255.p1DCtt0E049733@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@188776?ac=10

Change 188776 by trasz@trasz_victim on 2011/02/13 12:55:32

	When iterating over processes, we need to make sure the process
	structure is fully initialized, i.e. if p_state == PRS_NORMAL.
	Otherwise we may panic due to e.g. NULL thread lock pointer.

Affected files ...

.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#74 edit
.. //depot/projects/soc2009/trasz_limits/sys/vm/vm_pageout.c#27 edit

Differences ...

==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#74 (text+ko) ====

@@ -735,6 +735,8 @@
 		    NULL);
 
 		FOREACH_PROC_IN_SYSTEM(p) {
+			if (p->p_state != PRS_NORMAL)
+				continue;
 			if (p->p_flag & P_SYSTEM)
 				continue;
 

==== //depot/projects/soc2009/trasz_limits/sys/vm/vm_pageout.c#27 (text+ko) ====

@@ -1284,6 +1284,10 @@
 
 		if (PROC_TRYLOCK(p) == 0)
 			continue;
+		if (p->p_state != PRS_NORMAL) {
+			PROC_UNLOCK(p);
+			continue;
+		}
 		/*
 		 * If this is a system, protected or killed process, skip it.
 		 */
@@ -1662,6 +1666,10 @@
 			 * looked at this process, skip it.
 			 */
 			PROC_LOCK(p);
+			if (p->p_state != PRS_NORMAL) {
+				PROC_UNLOCK(p);
+				continue;
+			}
 			if (p->p_flag & (P_INEXEC | P_SYSTEM | P_WEXIT)) {
 				PROC_UNLOCK(p);
 				continue;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102131255.p1DCtt0E049733>