From a0e001a234796825f809e28c48880932b9e2aea9 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Fri, 7 Nov 2014 05:21:42 +0100 Subject: [PATCH] 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. --- sys/src/9/port/devproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/src/9/port/devproc.c b/sys/src/9/port/devproc.c index 42aa5bb12..93d92a10b 100644 --- a/sys/src/9/port/devproc.c +++ b/sys/src/9/port/devproc.c @@ -1258,8 +1258,8 @@ procstopwait(Proc *p, int ctl) qunlock(&p->debug); up->psstate = "Stopwait"; if(waserror()) { - p->pdbg = nil; qlock(&p->debug); + p->pdbg = nil; nexterror(); } sleep(&up->sleep, procstopped, p);