Skip site navigation (1)Skip section navigation (2)
Date:      23 May 2002 00:26:00 +0200
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        Miguel Mendez <flynn@energyhq.homeip.net>
Cc:        Kris Kennaway <kris@obsecurity.org>, current@FreeBSD.ORG
Subject:   Re: Problems with DP1
Message-ID:  <xzp3cwjg6pz.fsf@flood.ping.uio.no>
In-Reply-To: <20020522142103.A35455@energyhq.homeip.net>
References:  <20020521153334.A28241@energyhq.homeip.net> <20020521152746.A32988@xor.obsecurity.org> <20020522142103.A35455@energyhq.homeip.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Miguel Mendez <flynn@energyhq.homeip.net> writes:
> I've attached both a backtrace and my dmesg. Is any extra info needed?

RTFAQ.

> #10 0xc01d5899 in panic (fmt=0xc02fed34 "setrunnable(2)")
>     at ../../../kern/kern_shutdown.c:647
> #11 0xc01dbde2 in setrunnable (td=0xd21952a0) at ../../../kern/kern_synch.c:800
> #12 0xc01d8547 in psignal (p=0xd21951a0, sig=23) at ../../../kern/kern_sig.c:1517

Looks like a race: when psignal() was called, the process was stopped
or sleeping, but by the time setrunnable() was called, it was running.
Something is touching p_stat without acquiring sched_lock (psignal()
acquires it before examining p_stat, and holds it until it returns;
setrunnable() also acquires it - recusrively since psignal() already
holds it)

Somebody[tm] should take a close look at p_stat, where it's modified
and how it's protected, specifically:

des@des ~% current -nw p_stat | grep 'p_stat =[^=]'
sys/alpha/linux/linux_machdep.c: 183:   p2->p_stat = SRUN;
sys/i386/linux/linux_machdep.c: 364:            p2->p_stat = SRUN;
sys/kern/init_main.c: 329:      p->p_stat = SRUN;
sys/kern/init_main.c: 665:      initproc->p_stat = SRUN;
sys/kern/kern_condvar.c: 118:   td->td_proc->p_stat = SSLEEP;
sys/kern/kern_condvar.c: 152:           td->td_proc->p_stat = SRUN;
sys/kern/kern_condvar.c: 491:           td->td_proc->p_stat = SRUN;
sys/kern/kern_fork.c: 414:      p2->p_stat = SIDL;                      /* protect against others */
sys/kern/kern_fork.c: 701:              p2->p_stat = SRUN;
sys/kern/kern_idle.c: 63:               p->p_stat = SRUN;
sys/kern/kern_intr.c: 204:      p->p_stat = SWAIT;
sys/kern/kern_intr.c: 233:              p->p_stat = SRUN; /* XXXKSE */
sys/kern/kern_intr.c: 392:              p->p_stat = SRUN;
sys/kern/kern_intr.c: 552:                      p->p_stat = SWAIT; /* we're idle */
sys/kern/kern_kthread.c: 112:           p2->p_stat = SRUN;
sys/kern/kern_mutex.c: 588:             td->td_proc->p_stat = SMTX;
sys/kern/kern_mutex.c: 725:     td1->td_proc->p_stat = SRUN;
sys/kern/kern_synch.c: 495:             td->td_proc->p_stat = SSLEEP;
sys/kern/kern_synch.c: 629:                             td->td_proc->p_stat = SRUN;
sys/kern/kern_synch.c: 674:                             td->td_proc->p_stat = SRUN;
sys/kern/kern_synch.c: 812:     td->td_proc->p_stat = SRUN;
sys/kern/kern_sig.c: 1441:                              p->p_stat = SSLEEP;
sys/kern/kern_sig.c: 1709:      p->p_stat = SSTOP;
sys/kern/kern_exit.c: 436:      p->p_stat = SZOMB;

One of these is touching p_stat without holding sched_lock.

DES
-- 
Dag-Erling Smorgrav - des@ofug.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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