Commit 09739d28 authored by Austin Clements's avatar Austin Clements

runtime: call throw on systemstack in exitsyscall

If exitsyscall tries to grow the stack it will panic, but throw calls
print, which can grow the stack. Move the two bare throws in
exitsyscall to the system stack.

Updates #21431.

Change-Id: I5b29da5d34ade908af648a12075ed327a864476c
Reviewed-on: https://go-review.googlesource.com/79517
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent c6c0f47e
...@@ -2939,7 +2939,9 @@ func exitsyscall(dummy int32) { ...@@ -2939,7 +2939,9 @@ func exitsyscall(dummy int32) {
oldp := _g_.m.p.ptr() oldp := _g_.m.p.ptr()
if exitsyscallfast() { if exitsyscallfast() {
if _g_.m.mcache == nil { if _g_.m.mcache == nil {
throw("lost mcache") systemstack(func() {
throw("lost mcache")
})
} }
if trace.enabled { if trace.enabled {
if oldp != _g_.m.p.ptr() || _g_.m.syscalltick != _g_.m.p.ptr().syscalltick { if oldp != _g_.m.p.ptr() || _g_.m.syscalltick != _g_.m.p.ptr().syscalltick {
...@@ -2986,7 +2988,9 @@ func exitsyscall(dummy int32) { ...@@ -2986,7 +2988,9 @@ func exitsyscall(dummy int32) {
mcall(exitsyscall0) mcall(exitsyscall0)
if _g_.m.mcache == nil { if _g_.m.mcache == nil {
throw("lost mcache") systemstack(func() {
throw("lost mcache")
})
} }
// Scheduler returned, so we're allowed to run now. // Scheduler returned, so we're allowed to run now.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment