diff options
| author | Austin Clements <austin@google.com> | 2019-12-02 17:36:25 -0500 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2019-12-05 01:48:14 +0000 |
| commit | 8174f7fb2b64c221f7f80c9f7fd4d7eb317ac8bb (patch) | |
| tree | 14e617cf022bfc197221468d24c1a66bed6c193c /src/runtime/sys_linux_amd64.s | |
| parent | fa3a121a79f85a4c957f29372b5ebfde7211a980 (diff) | |
| download | go-8174f7fb2b64c221f7f80c9f7fd4d7eb317ac8bb.tar.xz | |
runtime: mlock top of signal stack on Linux 5.2–5.4.1
Linux 5.2 introduced a bug that can corrupt vector registers on return
from a signal if the signal stack isn't faulted in:
https://bugzilla.kernel.org/show_bug.cgi?id=205663
This CL works around this by mlocking the top page of all Go signal
stacks on the affected kernels.
Fixes #35326, #35777
Change-Id: I77c80a2baa4780827633f92f464486caa222295d
Reviewed-on: https://go-review.googlesource.com/c/go/+/209899
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/runtime/sys_linux_amd64.s')
| -rw-r--r-- | src/runtime/sys_linux_amd64.s | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index d16060f6fa..174120f887 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -33,8 +33,10 @@ #define SYS_clone 56 #define SYS_exit 60 #define SYS_kill 62 +#define SYS_uname 63 #define SYS_fcntl 72 #define SYS_sigaltstack 131 +#define SYS_mlock 149 #define SYS_arch_prctl 158 #define SYS_gettid 186 #define SYS_futex 202 @@ -764,3 +766,20 @@ TEXT runtime·sbrk0(SB),NOSPLIT,$0-8 SYSCALL MOVQ AX, ret+0(FP) RET + +// func uname(utsname *new_utsname) int +TEXT ·uname(SB),NOSPLIT,$0-16 + MOVQ utsname+0(FP), DI + MOVL $SYS_uname, AX + SYSCALL + MOVQ AX, ret+8(FP) + RET + +// func mlock(addr, len uintptr) int +TEXT ·mlock(SB),NOSPLIT,$0-24 + MOVQ addr+0(FP), DI + MOVQ len+8(FP), SI + MOVL $SYS_mlock, AX + SYSCALL + MOVQ AX, ret+16(FP) + RET |
