Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Aug 2005 21:59:13 +0200
From:      Antoine Pelisse <apelisse@gmail.com>
To:        freebsd-current@freebsd.org
Subject:   Fix for some stress panics
Message-ID:  <61c7468305080712591f8c7fda@mail.gmail.com>

next in thread | raw e-mail | index | archive | help

http://people.freebsd.org/~pho/stress/log/cons149.html
http://people.freebsd.org/~pho/stress/log/cons130.html

I've been working on this panic today (the two are obviously 
the same) and here is a patch to fix it:
--- sys/kern/kern_proc.c.orig Mon Apr 18 04:10:36 2005
+++ sys/kern/kern_proc.c Sun Aug 7 21:18:03 2005
@@ -884,10 +884,8 @@
_PHOLD(p);
FOREACH_THREAD_IN_PROC(p, td) {
fill_kinfo_thread(td, &kinfo_proc);
- PROC_UNLOCK(p);
error = SYSCTL_OUT(req, (caddr_t)&kinfo_proc,
sizeof(kinfo_proc));
- PROC_LOCK(p);
if (error)
break;
}

As a matter of fact, if td is removed from the list through thread_unlink 
while
the mutex is released and the next thread is removed just after, the FOREACH 

is looping through an unlinked list where the td_ksegrp has been set to NULL 

by thread_exit.
If we absolutely have to release the lock, then it's probably safer to check 
if 
td_ksegroup != NULL in the fill_kinfo_thread function.

Regards, 
Antoine Pelisse.



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