--- a/sys/src/9/port/proc.c Thu Apr 5 20:21:39 2018 +++ b/sys/src/9/port/proc.c Wed Feb 4 20:30:44 2026 @@ -894,7 +894,9 @@ lock(r); p = r->p; - if(p != nil){ + if(p == nil) + unlock(r); + else{ lock(&p->rlock); if(p->state != Wakeme || p->r != r){ iprint("%p %p %d\n", p->r, r, p->state); @@ -902,10 +904,10 @@ } r->p = nil; p->r = nil; + unlock(r); ready(p); unlock(&p->rlock); } - unlock(r); splx(s); @@ -958,8 +960,13 @@ panic("postnote: state %d %d %d", r->p != p, p->r != r, p->state); p->r = nil; r->p = nil; - ready(p); + /* + * The unlock must precede ready(p), in case the readied process + * immediately deallocates the Rendez. This can happen with semacquire, + * where the Rendez is on the stack. + */ unlock(r); + ready(p); break; }