]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.10] runtime: use Android O friendly faccessat syscall on linux...
authorTobias Klauser <tklauser@distanz.ch>
Thu, 15 Mar 2018 09:21:57 +0000 (10:21 +0100)
committerAndrew Bonventre <andybons@golang.org>
Thu, 29 Mar 2018 06:08:18 +0000 (06:08 +0000)
The Android O seccomp policy disallows the access syscall on amd64, see
https://android.googlesource.com/platform/bionic/+/android-4.2.2_r1.2/libc/SYSCALLS.TXT

Use the faccessat syscall with AT_FDCWD instead to achieve the same
behavior.

Updates #24403

Change-Id: I9db847c1c0f33987a3479b3f96e721fb9588cde2
Reviewed-on: https://go-review.googlesource.com/100877
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/102995
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/sys_linux_amd64.s

index 576a91a85ca4bea4d981c9fb6a334006fa0c1d8c..a5db5cba23757c51ed57e765fdfd297cf49dee66 100644 (file)
@@ -21,7 +21,6 @@
 #define SYS_rt_sigaction       13
 #define SYS_rt_sigprocmask     14
 #define SYS_rt_sigreturn       15
-#define SYS_access             21
 #define SYS_sched_yield        24
 #define SYS_mincore            27
 #define SYS_madvise            28
@@ -44,6 +43,7 @@
 #define SYS_exit_group         231
 #define SYS_epoll_ctl          233
 #define SYS_openat             257
+#define SYS_faccessat          269
 #define SYS_pselect6           270
 #define SYS_epoll_pwait                281
 #define SYS_epoll_create1      291
@@ -682,9 +682,12 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
 
 // int access(const char *name, int mode)
 TEXT runtime·access(SB),NOSPLIT,$0
-       MOVQ    name+0(FP), DI
-       MOVL    mode+8(FP), SI
-       MOVL    $SYS_access, AX
+       // This uses faccessat instead of access, because Android O blocks access.
+       MOVL    $AT_FDCWD, DI // AT_FDCWD, so this acts like access
+       MOVQ    name+0(FP), SI
+       MOVL    mode+8(FP), DX
+       MOVL    $0, R10
+       MOVL    $SYS_faccessat, AX
        SYSCALL
        MOVL    AX, ret+16(FP)
        RET