From 8584445289f3ee3b02dd3d2b24a137c9f282ab75 Mon Sep 17 00:00:00 2001 From: Hector Chu Date: Tue, 11 Oct 2011 12:57:16 -0400 Subject: [PATCH] runtime: fix crash when returning from syscall during gc gp->m can go from non-nil to nil when it re-enters schedule(). R=golang-dev CC=golang-dev, rsc https://golang.org/cl/5245042 --- src/pkg/runtime/mgc0.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c index 797d011064..6f7e2459d9 100644 --- a/src/pkg/runtime/mgc0.c +++ b/src/pkg/runtime/mgc0.c @@ -597,6 +597,7 @@ handoff(Workbuf *b) static void scanstack(void (*scanblock)(byte*, int64), G *gp) { + M *mp; int32 n; Stktop *stk; byte *sp, *guard; @@ -607,8 +608,8 @@ scanstack(void (*scanblock)(byte*, int64), G *gp) if(gp == g) { // Scanning our own stack: start at &gp. sp = (byte*)&gp; - } else if(gp->m != nil && gp->m->helpgc) { - // Gc helper scans its own stack. + } else if((mp = gp->m) != nil && mp->helpgc) { + // gchelper's stack is in active use and has no interesting pointers. return; } else { // Scanning another goroutine's stack. -- 2.48.1