Skip to content

Commit f59f9b8

Browse files
committed
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 <[email protected]>
1 parent 6731063 commit f59f9b8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/runtime/race_amd64.s

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,9 @@ TEXT runtime·racesymbolizethunk(SB), NOSPLIT, $56-8
383383
MOVQ g_m(R13), R13
384384
MOVQ m_g0(R13), R14
385385
MOVQ R14, g(R12) // g = m->g0
386-
MOVQ RARG0, 0(SP) // func arg
386+
PUSHQ RARG0 // func arg
387387
CALL runtime·racesymbolize(SB)
388+
POPQ R12
388389
// All registers are smashed after Go code, reload.
389390
get_tls(R12)
390391
MOVQ g(R12), R13

0 commit comments

Comments
 (0)