]> Cypherpunks repositories - gostls13.git/commit
runtime: restore RSB for sigpanic call on mips64x
authorAustin Clements <austin@google.com>
Wed, 31 Jan 2018 19:34:36 +0000 (14:34 -0500)
committerAustin Clements <austin@google.com>
Wed, 31 Jan 2018 20:57:53 +0000 (20:57 +0000)
commite5186895fc7954c0992c345eb2a91f8c964b2099
tree4bd3cb0c4ab324365b37ae1acbdf6cc919cdafd8
parent3ff41cdffade9e7b5a78fa56a43351dbd665df7a
runtime: restore RSB for sigpanic call on mips64x

preparePanic must set all registers expected by Go runtime conventions
in case the sigpanic is being injected into C code. However, on
mips64x it fails to restore RSB (R28). As a result, if C code modifies
RSB and then raises a signal that turns into a sigpanic call, sigpanic
may crash when it attempts to lock runtime.debuglock (the first global
it references).

Fix this by restoring RSB in the signal context using the same
convention as main and sigtramp.

Fixes #23641.

Change-Id: Ib47e83df89e2a3eece10f480e4e91ce9e4424388
Reviewed-on: https://go-review.googlesource.com/91156
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/runtime/signal_linux_mips64x.go
src/runtime/signal_mips64x.go