On Fri, 11 May 2012, Xin LI wrote:

Log:
??Revert previous revision, misunderstood the code :(

Modified:
??head/sys/kern/kern_kthread.c

Modified: head/sys/kern/kern_kthread.c
==============================================================================
--- head/sys/kern/kern_kthread.c ?? ?? ?? ??Fri May 11 23:41:52 2012 ?? ?? ?? 
??(r235300)
+++ head/sys/kern/kern_kthread.c ?? ?? ?? ??Fri May 11 23:43:32 2012 ?? ?? ?? 
??(r235301)
@@ -182,7 +182,6 @@ kproc_suspend(struct proc *p, int timo)
?? ?? ?? ?? ?? ?? ?? ??return (EINVAL);
?? ?? ?? ??}
?? ?? ?? ??SIGADDSET(p->p_siglist, SIGSTOP);
- ?? ?? ?? PROC_UNLOCK(p);
?? ?? ?? ??wakeup(p);
?? ?? ?? ??return msleep(&p->p_siglist, &p->p_mtx, PPAUSE | PDROP, "suspkp", 
timo);

Please don't use mailer clients that corrupt whitespace to binary characters.
The above is unreadable in vi (but i remember it from the original).

For the record, p->p_mtx is the mutex used by PROC_[UN]LOCK(), which
has to be held while calling msleep().

Even if it weren't, dropping the lock before sleeping would give a classic
race.

Otherwise, PROC_UNLOCK() is a good obfuscation.  p_mtx in the sleep call
isn't similarly obfuscated.  Some subsystems have a macro that obfuscates
the name of their lock(s) too, but proc.h doesn't.  kern/*.c has 23
hard-coded references of the form &somep->p_mtx.

Bruce
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to