Skip to content

Commit 8d90bb4

Browse files
tklauserandybons
authored andcommitted
[release-branch.go1.10] runtime: use Android O friendly faccessat syscall on linux/amd64
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-on: https://go-review.googlesource.com/102995 Run-TryBot: Andrew Bonventre <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 2487994 commit 8d90bb4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/runtime/sys_linux_amd64.s

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#define SYS_rt_sigaction 13
2222
#define SYS_rt_sigprocmask 14
2323
#define SYS_rt_sigreturn 15
24-
#define SYS_access 21
2524
#define SYS_sched_yield 24
2625
#define SYS_mincore 27
2726
#define SYS_madvise 28
@@ -44,6 +43,7 @@
4443
#define SYS_exit_group 231
4544
#define SYS_epoll_ctl 233
4645
#define SYS_openat 257
46+
#define SYS_faccessat 269
4747
#define SYS_pselect6 270
4848
#define SYS_epoll_pwait 281
4949
#define SYS_epoll_create1 291
@@ -682,9 +682,12 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
682682

683683
// int access(const char *name, int mode)
684684
TEXT runtime·access(SB),NOSPLIT,$0
685-
MOVQ name+0(FP), DI
686-
MOVL mode+8(FP), SI
687-
MOVL $SYS_access, AX
685+
// This uses faccessat instead of access, because Android O blocks access.
686+
MOVL $AT_FDCWD, DI // AT_FDCWD, so this acts like access
687+
MOVQ name+0(FP), SI
688+
MOVL mode+8(FP), DX
689+
MOVL $0, R10
690+
MOVL $SYS_faccessat, AX
688691
SYSCALL
689692
MOVL AX, ret+16(FP)
690693
RET

0 commit comments

Comments
 (0)