summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/proc.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-04-08 13:24:53 -0700
committerRuss Cox <rsc@golang.org>2010-04-08 13:24:53 -0700
commit1fa9a0c209f50aa6b8eac0755ce6ccd00ff2cf02 (patch)
treeda05f5d25317cb06e704f85c8a9c07943aa64f90 /src/pkg/runtime/proc.c
parent9d82a4bd77f53f0fdf78cfbf09d33ea4f3b37a02 (diff)
downloadgolang-1fa9a0c209f50aa6b8eac0755ce6ccd00ff2cf02.tar.gz
runtime: fix bad status throw
when garbage collector sees recovering goroutine Fixes issue 711. R=r CC=golang-dev http://codereview.appspot.com/869045
Diffstat (limited to 'src/pkg/runtime/proc.c')
-rw-r--r--src/pkg/runtime/proc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index 454a4a217..1a1895dcb 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -461,9 +461,7 @@ scheduler(void)
// unwind to the stack frame with d->sp in it.
unwindstack(gp, d->sp);
- if(d->sp < gp->stackguard || gp->stackbase < d->sp)
- throw("bad stack in recovery");
-
+
// make the deferproc for this d return again,
// this time returning 1. function will jump to
// standard return epilogue.
@@ -930,6 +928,11 @@ unwindstack(G *gp, byte *sp)
gp->stackguard = top->stackguard;
free(stk);
}
+
+ if(sp != nil && (sp < gp->stackguard - StackGuard || gp->stackbase < sp)) {
+ printf("recover: %p not in [%p, %p]\n", sp, gp->stackguard - StackGuard, gp->stackbase);
+ throw("bad unwindstack");
+ }
}
static void