1
0
mirror of https://github.com/golang/go synced 2024-10-07 22:31:21 -06:00
go/misc
Hector Martin Cantero 7283e08cbf runtime: keep g->syscallsp consistent after cgo->Go callbacks
Normally, the caller to runtime.entersyscall() must not return before
calling runtime.exitsyscall(), lest g->syscallsp become a dangling
pointer. runtime.cgocallbackg() violates this constraint. To work around
this, save g->syscallsp and g->syscallpc around cgo->Go callbacks, then
restore them after calling runtime.entersyscall(), which restores the
syscall stack frame pointer saved by cgocall. This allows the GC to
correctly trace a goroutine that is currently returning from a
Go->cgo->Go chain.

This also adds a check to proc.c that panics if g->syscallsp is clearly
invalid. It is not 100% foolproof, as it will not catch a case where the
stack was popped then pushed back beyond g->syscallsp, but it does catch
the present cgo issue and makes existing tests fail without the bugfix.

Fixes #7978.

LGTM=dvyukov, rsc
R=golang-codereviews, dvyukov, minux, bradfitz, iant, gobot, rsc
CC=golang-codereviews, rsc
https://golang.org/cl/131910043
2014-09-24 13:20:25 -04:00
..
android build: adjustments for move from src/pkg to src 2014-09-08 00:06:45 -04:00
arm arm: add gdb support to android launcher script 2010-07-30 10:35:07 +03:00
cgo runtime: keep g->syscallsp consistent after cgo->Go callbacks 2014-09-24 13:20:25 -04:00
chrome/gophertool gophertool: fix links 2012-10-22 01:05:21 +08:00
dashboard/codereview misc/dashboard/app, misc/dashboard/builder: delete from main repo; part of move to go.tools 2013-08-01 13:27:27 +10:00
git misc/git: add gofmt git pre-commit hook 2012-11-15 19:58:49 +01:00
linkcheck misc/linkcheck: better redirect handling, use meaningful exit code 2013-10-25 17:31:02 +03:00
makerelease build: adjustments for move from src/pkg to src 2014-09-08 00:06:45 -04:00
nacl build: more adjustments for move from src/pkg to src 2014-09-08 00:22:40 -04:00
swig cmd/go: add any .c/.cc files to the SWIG shared library 2013-10-09 10:35:46 -07:00
benchcmp benchcmp: leave a forwarding script 2014-03-31 16:39:41 -04:00
editors misc: delete editor and shell support 2014-07-01 09:21:25 -07:00
pprof misc/pprof: support web profiles on windows/MinGW 2014-07-23 10:35:04 -07:00