diff options
author | Austin Clements <austin@google.com> | 2018-01-12 12:39:22 -0500 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2018-03-08 22:55:52 +0000 |
commit | 7f1b2738bb7a8863ee78d5357acbc820b7083821 (patch) | |
tree | d677547399574e29efe3fdd4b0d2d87cb566f6d9 /src/runtime/asm_mips64x.s | |
parent | 9d59234cbe55c32b6b64969a4360ecccfce582fd (diff) | |
download | go-7f1b2738bb7a8863ee78d5357acbc820b7083821.tar.gz go-7f1b2738bb7a8863ee78d5357acbc820b7083821.zip |
runtime: make throw safer to call
Currently, throw may grow the stack, which means whenever we call it
from a context where it's not safe to grow the stack, we first have to
switch to the system stack. This is pretty easy to get wrong.
Fix this by making throw switch to the system stack so it doesn't grow
the stack and is hence safe to call without a system stack switch at
the call site.
The only thing this complicates is badsystemstack itself, which would
now go into an infinite loop before printing anything (previously it
would also go into an infinite loop, but would at least print the
error first). Fix this by making badsystemstack do a direct write and
then crash hard.
Change-Id: Ic5b4a610df265e47962dcfa341cabac03c31c049
Reviewed-on: https://go-review.googlesource.com/93659
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/asm_mips64x.s')
-rw-r--r-- | src/runtime/asm_mips64x.s | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/runtime/asm_mips64x.s b/src/runtime/asm_mips64x.s index 00a7951fc1..e4a5a32ad0 100644 --- a/src/runtime/asm_mips64x.s +++ b/src/runtime/asm_mips64x.s @@ -179,6 +179,7 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8 // Hide call from linker nosplit analysis. MOVV $runtime·badsystemstack(SB), R4 JAL (R4) + JAL runtime·abort(SB) switch: // save our state in g->sched. Pretend to |