From 8380de416bbb3550de902374b7626e569060a712 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Thu, 27 Oct 2016 17:36:39 -0400 Subject: runtime: align stack pointer in sigfwd sigfwd calls an arbitrary C signal handler function. The System V ABI for x86_64 (and the most recent revision of the ABI for i386) requires the stack to be 16-byte aligned. Fixes: #17641 Change-Id: I77f53d4a8c29c1b0fe8cfbcc8d5381c4e6f75a6b Reviewed-on: https://go-review.googlesource.com/32107 Run-TryBot: Bryan Mills TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/runtime/sys_linux_386.s | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/runtime/sys_linux_386.s') diff --git a/src/runtime/sys_linux_386.s b/src/runtime/sys_linux_386.s index 86ca06fd2c..1d798c741e 100644 --- a/src/runtime/sys_linux_386.s +++ b/src/runtime/sys_linux_386.s @@ -212,14 +212,20 @@ TEXT runtime·rt_sigaction(SB),NOSPLIT,$0 RET TEXT runtime·sigfwd(SB),NOSPLIT,$12-16 - MOVL sig+4(FP), AX - MOVL AX, 0(SP) - MOVL info+8(FP), AX - MOVL AX, 4(SP) - MOVL ctx+12(FP), AX - MOVL AX, 8(SP) MOVL fn+0(FP), AX + MOVL sig+4(FP), BX + MOVL info+8(FP), CX + MOVL ctx+12(FP), DX + MOVL SP, SI + SUBL $32, SP + ANDL $-15, SP // align stack: handler might be a C function + MOVL BX, 0(SP) + MOVL CX, 4(SP) + MOVL DX, 8(SP) + MOVL SI, 12(SP) // save SI: handler might be a Go function CALL AX + MOVL 12(SP), AX + MOVL AX, SP RET TEXT runtime·sigtramp(SB),NOSPLIT,$12 -- cgit v1.3