aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_darwin_amd64.s
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2017-02-02 18:50:45 -0800
committerKeith Randall <khr@golang.org>2017-02-03 05:08:54 +0000
commit69e1634985f8d839f74f342925bd7546faea0a19 (patch)
tree31dc8d4d50b6cb1ff9ebfb255de4e2acb0fe7f7d /src/runtime/sys_darwin_amd64.s
parent64c5280844aa7d6cbec18c47750f9d3e65f5f72a (diff)
downloadgo-69e1634985f8d839f74f342925bd7546faea0a19.tar.gz
go-69e1634985f8d839f74f342925bd7546faea0a19.zip
runtime: darwin/amd64, don't depend on outarg slots being unmodified
sigtramp was calling sigtrampgo and depending on the fact that the 3rd argument slot will not be modified on return. Our calling convention doesn't guarantee that. Avoid that assumption. There's no actual bug here, as sigtrampgo does not in fact modify its argument slots. But I found this while working on the dead stack slot clobbering tool. https://go-review.googlesource.com/c/23924/ Change-Id: Ia7e791a2b4c1c74fff24cba8169e7840b4b06ffc Reviewed-on: https://go-review.googlesource.com/36216 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/sys_darwin_amd64.s')
-rw-r--r--src/runtime/sys_darwin_amd64.s5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/runtime/sys_darwin_amd64.s b/src/runtime/sys_darwin_amd64.s
index e68dafe6a6..f94482856c 100644
--- a/src/runtime/sys_darwin_amd64.s
+++ b/src/runtime/sys_darwin_amd64.s
@@ -252,14 +252,15 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
POPQ BP
RET
-TEXT runtime·sigtramp(SB),NOSPLIT,$32
+TEXT runtime·sigtramp(SB),NOSPLIT,$40
MOVL SI, 24(SP) // save infostyle for sigreturn below
+ MOVQ R8, 32(SP) // save ctx
MOVL DX, 0(SP) // sig
MOVQ CX, 8(SP) // info
MOVQ R8, 16(SP) // ctx
MOVQ $runtime·sigtrampgo(SB), AX
CALL AX
- MOVQ 16(SP), DI // ctx
+ MOVQ 32(SP), DI // ctx
MOVL 24(SP), SI // infostyle
MOVL $(0x2000000+184), AX
SYSCALL