aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_linux_ppc64x.s
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2018-09-06 17:21:59 -0700
committerIan Lance Taylor <iant@golang.org>2018-09-07 22:50:28 +0000
commit43f54c8d2e3bddfc6ad7887286eb6564986cb6ad (patch)
tree4883ebc958846178fbcf544e44d22a6599b42be6 /src/runtime/sys_linux_ppc64x.s
parentceb7745cc846f798531ef019162dd9f1dabfea12 (diff)
downloadgo-43f54c8d2e3bddfc6ad7887286eb6564986cb6ad.tar.gz
go-43f54c8d2e3bddfc6ad7887286eb6564986cb6ad.zip
runtime: use tgkill for raise
raise uses tkill to send a signal to the current thread. For this use, tgkill is functionally equivalent to tkill expect that it also takes the pid as the first argument. Using tgkill makes it simpler to run a Go program in a strict sandbox. With kill and tgkill, the sandbox policy (e.g., seccomp) can prevent the program from sending signals to other processes by checking that the first argument == getpid(). With tkill, the policy must whitelist all tids in the process, which is effectively impossible given Go's dynamic thread creation. Fixes #27548 Change-Id: I8ed282ef1f7215b02ef46de144493e36454029ea Reviewed-on: https://go-review.googlesource.com/133975 Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/sys_linux_ppc64x.s')
-rw-r--r--src/runtime/sys_linux_ppc64x.s11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/runtime/sys_linux_ppc64x.s b/src/runtime/sys_linux_ppc64x.s
index 075adf2368..7c2f8ea637 100644
--- a/src/runtime/sys_linux_ppc64x.s
+++ b/src/runtime/sys_linux_ppc64x.s
@@ -36,7 +36,6 @@
#define SYS_madvise 205
#define SYS_mincore 206
#define SYS_gettid 207
-#define SYS_tkill 208
#define SYS_futex 221
#define SYS_sched_getaffinity 223
#define SYS_exit_group 234
@@ -44,6 +43,7 @@
#define SYS_epoll_ctl 237
#define SYS_epoll_wait 238
#define SYS_clock_gettime 246
+#define SYS_tgkill 250
#define SYS_epoll_create1 315
TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0-4
@@ -123,10 +123,13 @@ TEXT runtime·gettid(SB),NOSPLIT,$0-4
RET
TEXT runtime·raise(SB),NOSPLIT|NOFRAME,$0
+ SYSCALL $SYS_getpid
+ MOVW R3, R14
SYSCALL $SYS_gettid
- MOVW R3, R3 // arg 1 tid
- MOVW sig+0(FP), R4 // arg 2
- SYSCALL $SYS_tkill
+ MOVW R3, R4 // arg 2 tid
+ MOVW R14, R3 // arg 1 pid
+ MOVW sig+0(FP), R5 // arg 3
+ SYSCALL $SYS_tgkill
RET
TEXT runtime·raiseproc(SB),NOSPLIT|NOFRAME,$0