aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/msan_arm64.s
diff options
context:
space:
mode:
authorfanzha02 <fannie.zhang@arm.com>2019-09-17 07:49:47 +0000
committerIan Lance Taylor <iant@golang.org>2019-09-18 20:35:15 +0000
commit827584e2f3a76c6a94447197fc6dcb8152382369 (patch)
treee2ffe2d71114bc543a4f815232ad7ebc206d4a89 /src/runtime/msan_arm64.s
parentbcf6f9fd4c601a2f51d737a6390a7e909096729a (diff)
downloadgo-827584e2f3a76c6a94447197fc6dcb8152382369.tar.gz
go-827584e2f3a76c6a94447197fc6dcb8152382369.zip
runtime: check for nil g in msancall() on arm64
The current msanwrite() segfaults during libpreinit when built with -msan on arm64. The cause is msancall() in runtime/msan_arm64.s called by msanwrite() assumes that it is always called with a valid g, leading to a segfult. This CL adds a check for nil g in msancall(). Fixes #34338 Change-Id: If4ad7e37556cd1d99346c1a7b4852651d1e4e4aa Reviewed-on: https://go-review.googlesource.com/c/go/+/196157 Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/msan_arm64.s')
-rw-r--r--src/runtime/msan_arm64.s3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/runtime/msan_arm64.s b/src/runtime/msan_arm64.s
index 4dfe5e3133..5e29f1aefb 100644
--- a/src/runtime/msan_arm64.s
+++ b/src/runtime/msan_arm64.s
@@ -47,9 +47,10 @@ TEXT runtimeĀ·msanfree(SB), NOSPLIT, $0-16
// Switches SP to g0 stack and calls (FARG). Arguments already set.
TEXT msancall<>(SB), NOSPLIT, $0-0
+ MOVD RSP, R19 // callee-saved
+ CBZ g, g0stack // no g, still on a system stack
MOVD g_m(g), R10
MOVD m_g0(R10), R11
- MOVD RSP, R19 // callee-saved
CMP R11, g
BEQ g0stack