aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2015-02-13 17:14:48 +0300
committerDmitry Vyukov <dvyukov@google.com>2015-02-13 16:29:54 +0000
commitf59f9b85276b6f80b6e55ea747a5df64bb83ecce (patch)
tree19fd0166ff21e758615c9182182266547e9ac1c4
parent6731063e42e6c9831a19e1cc7b79658bd663ad9b (diff)
downloadgo-f59f9b85276b6f80b6e55ea747a5df64bb83ecce.tar.xz
runtime: fix stack corruption in race mode
MOVQ RARG0, 0(SP) smashes exactly what was saved by PUSHQ R15. This code managed to work somehow with the current race runtime, but corrupts caller arguments with new race runtime that I am testing. Change-Id: I9ffe8b5eee86451db36e99dbf4d11f320192e576 Reviewed-on: https://go-review.googlesource.com/4810 Reviewed-by: Keith Randall <khr@golang.org>
-rw-r--r--src/runtime/race_amd64.s3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/runtime/race_amd64.s b/src/runtime/race_amd64.s
index 972cbe3f8a..267cd6cec4 100644
--- a/src/runtime/race_amd64.s
+++ b/src/runtime/race_amd64.s
@@ -383,8 +383,9 @@ TEXT runtime·racesymbolizethunk(SB), NOSPLIT, $56-8
MOVQ g_m(R13), R13
MOVQ m_g0(R13), R14
MOVQ R14, g(R12) // g = m->g0
- MOVQ RARG0, 0(SP) // func arg
+ PUSHQ RARG0 // func arg
CALL runtime·racesymbolize(SB)
+ POPQ R12
// All registers are smashed after Go code, reload.
get_tls(R12)
MOVQ g(R12), R13