From: Ian Lance Taylor Date: Mon, 16 May 2016 22:39:43 +0000 (-0700) Subject: runtime: don't do a plain throw when throwsplit == true X-Git-Tag: go1.7beta1~156 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1f7a0d4b5ec7ef94b96755e9b95168abf86e9d71;p=gostls13.git runtime: don't do a plain throw when throwsplit == true The test case in #15639 somehow causes an invalid syscall frame. The failure is obscured because the throw occurs when throwsplit == true, which causes a "stack split at bad time" error when trying to print the throw message. This CL fixes the "stack split at bad time" by using systemstack. No test because there shouldn't be any way to trigger this error anyhow. Update #15639. Change-Id: I4240f3fd01bdc3c112f3ffd1316b68504222d9e1 Reviewed-on: https://go-review.googlesource.com/23153 Run-TryBot: Ian Lance Taylor Reviewed-by: Austin Clements --- diff --git a/src/runtime/proc.go b/src/runtime/proc.go index d7e51d7deb..15dcb95c9c 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2445,7 +2445,12 @@ func exitsyscall(dummy int32) { _g_.m.locks++ // see comment in entersyscall if getcallersp(unsafe.Pointer(&dummy)) > _g_.syscallsp { - throw("exitsyscall: syscall frame is no longer valid") + // throw calls print which may try to grow the stack, + // but throwsplit == true so the stack can not be grown; + // use systemstack to avoid that possible problem. + systemstack(func() { + throw("exitsyscall: syscall frame is no longer valid") + }) } _g_.waitsince = 0