aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_linux_mips64x.s
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-02-08 16:59:17 +0100
committerBrad Fitzpatrick <bradfitz@golang.org>2018-02-13 15:33:19 +0000
commit04e6ae6bc3ac9739568b0f1225ee5e2d53cba919 (patch)
tree697005aa758339e344f48a028fc86264658ec0ec /src/runtime/sys_linux_mips64x.s
parent4dad4ab57bc0cedcc8d164147262f7f6898282dd (diff)
downloadgo-04e6ae6bc3ac9739568b0f1225ee5e2d53cba919.tar.xz
runtime: use Android O friendly syscalls on 64-bit machines
Android O disallows open on 64-bit, so let's use openat with AT_FDCWD to achieve the same behavior. Android O disallows epoll_wait on 64-bit, so let's use epoll_pwait with the last argument as NULL to achieve the same behavior. See here: https://android.googlesource.com/platform/bionic/+/master/libc/seccomp/arm64_app_policy.cpp https://android.googlesource.com/platform/bionic/+/master/libc/seccomp/mips64_app_policy.cpp https://android.googlesource.com/platform/bionic/+/master/libc/seccomp/x86_64_app_policy.cpp Fixes #23750 Change-Id: If8d5a663357471e5d2c1f516151344a9d05b188a Reviewed-on: https://go-review.googlesource.com/92895 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/sys_linux_mips64x.s')
-rw-r--r--src/runtime/sys_linux_mips64x.s18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/runtime/sys_linux_mips64x.s b/src/runtime/sys_linux_mips64x.s
index 784e187e73..50e103bb63 100644
--- a/src/runtime/sys_linux_mips64x.s
+++ b/src/runtime/sys_linux_mips64x.s
@@ -16,7 +16,7 @@
#define SYS_exit 5058
#define SYS_read 5000
#define SYS_write 5001
-#define SYS_open 5002
+#define SYS_openat 5247
#define SYS_close 5003
#define SYS_getpid 5038
#define SYS_kill 5060
@@ -42,7 +42,7 @@
#define SYS_exit_group 5205
#define SYS_epoll_create 5207
#define SYS_epoll_ctl 5208
-#define SYS_epoll_wait 5209
+#define SYS_epoll_pwait 5272
#define SYS_clock_gettime 5222
#define SYS_epoll_create1 5285
#define SYS_brk 5012
@@ -67,10 +67,12 @@ TEXT runtime·exitThread(SB),NOSPLIT|NOFRAME,$0-8
JMP 0(PC)
TEXT runtime·open(SB),NOSPLIT|NOFRAME,$0-20
- MOVV name+0(FP), R4
- MOVW mode+8(FP), R5
- MOVW perm+12(FP), R6
- MOVV $SYS_open, R2
+ // This uses openat instead of open, because Android O blocks open.
+ MOVW $-100, R4 // AT_FDCWD, so this acts like open
+ MOVV name+0(FP), R5
+ MOVW mode+8(FP), R6
+ MOVW perm+12(FP), R7
+ MOVV $SYS_openat, R2
SYSCALL
BEQ R7, 2(PC)
MOVW $-1, R2
@@ -423,11 +425,13 @@ TEXT runtime·epollctl(SB),NOSPLIT|NOFRAME,$0
// int32 runtime·epollwait(int32 epfd, EpollEvent *ev, int32 nev, int32 timeout);
TEXT runtime·epollwait(SB),NOSPLIT|NOFRAME,$0
+ // This uses pwait instead of wait, because Android O blocks wait.
MOVW epfd+0(FP), R4
MOVV ev+8(FP), R5
MOVW nev+16(FP), R6
MOVW timeout+20(FP), R7
- MOVV $SYS_epoll_wait, R2
+ MOVV $0, R8
+ MOVV $SYS_epoll_pwait, R2
SYSCALL
MOVW R2, ret+24(FP)
RET