]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: in newstack, double-check calling goroutine
authorRuss Cox <rsc@golang.org>
Fri, 2 Aug 2013 17:51:28 +0000 (13:51 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 2 Aug 2013 17:51:28 +0000 (13:51 -0400)
Checking this condition helped me find the arm problem last night.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12267043

src/pkg/runtime/stack.c

index b959eb316d20da37e27602d74405b55c691d4b87..71c4c4caee4d8cc148e870d76359f59ee56fa6d2 100644 (file)
@@ -201,6 +201,13 @@ runtime·newstack(void)
        bool reflectcall;
        uintptr free;
 
+       if(m->morebuf.g != m->curg) {
+               runtime·printf("runtime: newstack called from g=%p\n"
+                       "\tm=%p m->curg=%p m->g0=%p m->gsignal=%p\n",
+                       m->morebuf.g, m, m->curg, m->g0, m->gsignal);
+               runtime·throw("runtime: wrong goroutine in newstack");
+       }
+
        // gp->status is usually Grunning, but it could be Gsyscall if a stack split
        // happens during a function call inside entersyscall.
        gp = m->curg;