Skip to content

Commit 69e1634

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 64c5280 commit 69e1634

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/runtime/sys_darwin_amd64.s

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,15 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
252252
POPQ BP
253253
RET
254254

255-
TEXT runtime·sigtramp(SB),NOSPLIT,$32
255+
TEXT runtime·sigtramp(SB),NOSPLIT,$40
256256
MOVL SI, 24(SP) // save infostyle for sigreturn below
257+
MOVQ R8, 32(SP) // save ctx
257258
MOVL DX, 0(SP) // sig
258259
MOVQ CX, 8(SP) // info
259260
MOVQ R8, 16(SP) // ctx
260261
MOVQ $runtime·sigtrampgo(SB), AX
261262
CALL AX
262-
MOVQ 16(SP), DI // ctx
263+
MOVQ 32(SP), DI // ctx
263264
MOVL 24(SP), SI // infostyle
264265
MOVL $(0x2000000+184), AX
265266
SYSCALL

0 commit comments

Comments
 (0)