PERFORCE change 188776 for review
Edward Tomasz Napierala
trasz at FreeBSD.org
Sun Feb 13 12:55:56 UTC 2011
http://p4web.freebsd.org/@@188776?ac=10
Change 188776 by trasz at 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;
More information about the p4-projects
mailing list