]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.5] runtime: make SIGPROF skip stacks that are being copied
authorAustin Clements <austin@google.com>
Wed, 11 Nov 2015 20:34:54 +0000 (15:34 -0500)
committerAustin Clements <austin@google.com>
Tue, 17 Nov 2015 02:24:49 +0000 (02:24 +0000)
commita8e839bb55bdba131d5c2f72d6bb49130fac55e3
tree6b7ba2f52553142c75bcef2a6a537f07573896f9
parentecb9ce6a781717364697c298e1d4c13e93e1c949
[release-branch.go1.5] runtime: make SIGPROF skip stacks that are being copied

sigprof tracebacks the stack across systemstack switches to make
profile tracebacks more complete. However, it does this even if the
user stack is currently being copied, which means it may be in an
inconsistent state that will cause the traceback to panic.

One specific way this can happen is during stack shrinking. Some
goroutine blocks for STW, then enters gchelper, which then assists
with root marking. If that root marking happens to pick the original
goroutine and its stack needs to be shrunk, it will begin to copy that
stack. During this copy, the stack is generally inconsistent and, in
particular, the actual locations of the stack barriers and their
recorded locations are temporarily out of sync. If a SIGPROF happens
during this inconsistency, it will walk the stack all the way back to
the blocked goroutine and panic when it fails to unwind the stack
barriers.

Fix this by disallowing jumping to the user stack during SIGPROF if
that user stack is in the process of being copied.

Fixes #12932.

Change-Id: I9ef694c2c01e3653e292ce22612418dd3daff1b4
Reviewed-on: https://go-review.googlesource.com/16819
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/16985
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/runtime/proc1.go