ref: a0e001a234796825f809e28c48880932b9e2aea9
parent: 20cc2799afd44ca156894fd96a1a72b61fc8a63a
author: cinap_lenrek <[email protected]>
date: Fri Nov 7 00:21:42 EST 2014
devproc: reset p->pdbg under p->debug qlock in procstopwait() theres a race where procstopwait() is interrupted by a note, setting p->pdbg to nil *before* acquiering the lock and and pexit() and procctl() accessing it assuming it doesnt change under them while they are holding the lock.
--- a/sys/src/9/port/devproc.c
+++ b/sys/src/9/port/devproc.c
@@ -1258,8 +1258,8 @@
qunlock(&p->debug);
up->psstate = "Stopwait";
if(waserror()) {
- p->pdbg = nil;
qlock(&p->debug);
+ p->pdbg = nil;
nexterror();
}
sleep(&up->sleep, procstopped, p);