diff --git a/src/runtime/stack.go b/src/runtime/stack.go index 00cd6aeb1dc..8f31c936be1 100644 --- a/src/runtime/stack.go +++ b/src/runtime/stack.go @@ -719,6 +719,10 @@ func copystack(gp *g, newsize uintptr) { print("copystack gp=", gp, " [", hex(old.lo), " ", hex(old.hi-used), " ", hex(old.hi), "]/", gp.stackAlloc, " -> [", hex(new.lo), " ", hex(new.hi-used), " ", hex(new.hi), "]/", newsize, "\n") } + // Disallow sigprof scans of this stack and block if there's + // one in progress. + gcLockStackBarriers(gp) + // adjust pointers in the to-be-copied frames var adjinfo adjustinfo adjinfo.old = old @@ -751,6 +755,8 @@ func copystack(gp *g, newsize uintptr) { gp.stkbar = newstkbar gp.stktopsp += adjinfo.delta + gcUnlockStackBarriers(gp) + // free old stack if stackPoisonCopy != 0 { fillstack(old, 0xfc)