aboutsummaryrefslogtreecommitdiff
path: root/src/os/exec
diff options
context:
space:
mode:
authorYoufu Zhang <zhangyoufu@gmail.com>2021-02-23 03:52:43 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2021-03-20 17:08:03 +0000
commite0fae78e1deeaae5bc3c6a8426ece37c62445bf4 (patch)
tree466dba0a2c801df33f6573e800d968d284e5f3a2 /src/os/exec
parent6ae3b70ef255cd7317764a12b7230f293683f2c5 (diff)
downloadgo-e0fae78e1deeaae5bc3c6a8426ece37c62445bf4.tar.xz
runtime: fix stack alignment for Windows amd64 lib entry
Windows amd64 calling convention requires 16-bytes aligned stack pointer. Before this patch, the real frame size is 0x48 (frame size) + 0x10 (frame pointer & return address), which does not satisfy the alignment requirement. _cgo_sys_thread_create eventually calls NtCreateThread, which receives a pointer to a ThreadContext structure allocated from (mis-aligned) stack, and may fail with STATUS_DATATYPE_MISALIGNMENT on some implementations. BP is saved/restored by prolog/epilog. AX, CX, DX are volatile, no need to save and restore. Fixes #41075 Change-Id: I01c0a22b4bf3b4cfdebf4df587445aa46c667973 GitHub-Last-Rev: 15d2bd740e3e61c9753b3e1b574fdb5da538459c GitHub-Pull-Request: golang/go#44524 Reviewed-on: https://go-review.googlesource.com/c/go/+/295329 Trust: Alex Brainman <alex.brainman@gmail.com> Trust: Jason A. Donenfeld <Jason@zx2c4.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Christopher Nelson <nadiasvertex@gmail.com>
Diffstat (limited to 'src/os/exec')
0 files changed, 0 insertions, 0 deletions