kern/167727: may missing PROC_UNLOCK() in kproc_suspend() of
kern_kthread.c
Jinjun Gao
gjinjun at gmail.com
Wed May 9 05:10:08 UTC 2012
>Number: 167727
>Category: kern
>Synopsis: may missing PROC_UNLOCK() in kproc_suspend() of kern_kthread.c
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed May 09 05:10:07 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Jinjun Gao
>Release: 7-release
>Organization:
>Environment:
FreeBSD 7.0-RELEASE FreeBSD 7-RELEASE #0: Sun Feb 24 10:35:36 UTC 2008 root at driscoll.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
In kernel's thread suspend code, maybe miss PROC_UNLOCK call.
kernel code: sys/kern/kern_kthread.c
...
/*
* Advise a kernel process to suspend (or resume) in its main loop.
* Participation is voluntary.
*/
int
kproc_suspend(struct proc *p, int timo)
{
/*
* Make sure this is indeed a system process and we can safely
* use the p_siglist field.
*/
PROC_LOCK(p);
if ((p->p_flag & P_KTHREAD) == 0) {
PROC_UNLOCK(p);
return (EINVAL);
}
SIGADDSET(p->p_siglist, SIGSTOP);
wakeup(p);
return msleep(&p->p_siglist, &p->p_mtx, PPAUSE | PDROP, "suspkp", timo);
}
We should add PROC_UNLOCK(p) after SIGADDSET(p->p_siglist, SIGSTOP).
>How-To-Repeat:
You can find these code at kernel source code.
>Fix:
add PROC_UNLOCK(p) after SIGADDSET(p->p_siglist, SIGSTOP);
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list