]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: avoid dup2 in forkAndExecInChild1 on Android
authorElias Naur <mail@eliasnaur.com>
Thu, 28 May 2020 11:58:45 +0000 (13:58 +0200)
committerElias Naur <mail@eliasnaur.com>
Thu, 28 May 2020 19:51:59 +0000 (19:51 +0000)
Android O and newer blocks the dup2 syscall.

Change-Id: Ibca01fc72ef114deeef6c0450a8b81a556ed0530
Reviewed-on: https://go-review.googlesource.com/c/go/+/235537
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/syscall/syscall_dup2_linux.go [new file with mode: 0644]
src/syscall/syscall_dup3_linux.go [new file with mode: 0644]
src/syscall/syscall_linux_386.go
src/syscall/syscall_linux_amd64.go
src/syscall/syscall_linux_arm.go
src/syscall/syscall_linux_arm64.go
src/syscall/syscall_linux_mips64x.go
src/syscall/syscall_linux_mipsx.go
src/syscall/syscall_linux_ppc64x.go
src/syscall/syscall_linux_riscv64.go
src/syscall/syscall_linux_s390x.go

diff --git a/src/syscall/syscall_dup2_linux.go b/src/syscall/syscall_dup2_linux.go
new file mode 100644 (file)
index 0000000..f03a923
--- /dev/null
@@ -0,0 +1,10 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build !android
+// +build 386 amd64 arm mips mipsle mips64 mips64le ppc64 ppc64le s390x
+
+package syscall
+
+const _SYS_dup = SYS_DUP2
diff --git a/src/syscall/syscall_dup3_linux.go b/src/syscall/syscall_dup3_linux.go
new file mode 100644 (file)
index 0000000..1ebdcb2
--- /dev/null
@@ -0,0 +1,9 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build android arm64 riscv64
+
+package syscall
+
+const _SYS_dup = SYS_DUP3
index 3c1e6e4218c36093bff3082f46816a3721befddf..5076dd97ab9c934b41c896ff28703bf94964ee06 100644 (file)
@@ -9,10 +9,7 @@ package syscall
 
 import "unsafe"
 
-const (
-       _SYS_dup       = SYS_DUP2
-       _SYS_setgroups = SYS_SETGROUPS32
-)
+const _SYS_setgroups = SYS_SETGROUPS32
 
 func setTimespec(sec, nsec int64) Timespec {
        return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
index 0f28b55d4735cf79e0458ce6782f33f5bbd27116..bf340d9996c72ce5876a4fa63240dffc5308c29c 100644 (file)
@@ -4,10 +4,7 @@
 
 package syscall
 
-const (
-       _SYS_dup       = SYS_DUP2
-       _SYS_setgroups = SYS_SETGROUPS
-)
+const _SYS_setgroups = SYS_SETGROUPS
 
 //sys  Dup2(oldfd int, newfd int) (err error)
 //sysnb        EpollCreate(size int) (fd int, err error)
index d346029a1f38cbc2dabd1347191d65bbf183c511..c4c403a40036f7b85cac9849802c688094a967fa 100644 (file)
@@ -6,10 +6,7 @@ package syscall
 
 import "unsafe"
 
-const (
-       _SYS_dup       = SYS_DUP2
-       _SYS_setgroups = SYS_SETGROUPS32
-)
+const _SYS_setgroups = SYS_SETGROUPS32
 
 func setTimespec(sec, nsec int64) Timespec {
        return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
index 1ad9dd8ea3d3a365f565d2182e6a7c89bbc2111c..61014b264a8e45a09a94a1fe225d00ef87a55abf 100644 (file)
@@ -6,10 +6,7 @@ package syscall
 
 import "unsafe"
 
-const (
-       _SYS_dup       = SYS_DUP3
-       _SYS_setgroups = SYS_SETGROUPS
-)
+const _SYS_setgroups = SYS_SETGROUPS
 
 func EpollCreate(size int) (fd int, err error) {
        if size <= 0 {
index 157c32326b7f0ccdafc1a9ee43c3f55562245cfc..e3683def67ab93ceb1dd2a5171fa3056307faee4 100644 (file)
@@ -7,10 +7,7 @@
 
 package syscall
 
-const (
-       _SYS_dup       = SYS_DUP2
-       _SYS_setgroups = SYS_SETGROUPS
-)
+const _SYS_setgroups = SYS_SETGROUPS
 
 //sys  Dup2(oldfd int, newfd int) (err error)
 //sysnb        EpollCreate(size int) (fd int, err error)
index f2fea71aac308ce36f6ad7546afb96dcb4f649b6..cbe2f0233fd521dbe8c0bc05d1e36f8e8e4b949b 100644 (file)
@@ -9,10 +9,7 @@ package syscall
 
 import "unsafe"
 
-const (
-       _SYS_dup       = SYS_DUP2
-       _SYS_setgroups = SYS_SETGROUPS
-)
+const _SYS_setgroups = SYS_SETGROUPS
 
 func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno)
 
index 22d6e560103f12366f99d199546bf61444628884..ba52e5a3accf92e46d72c9ce006e176d4551821b 100644 (file)
@@ -7,10 +7,7 @@
 
 package syscall
 
-const (
-       _SYS_dup       = SYS_DUP2
-       _SYS_setgroups = SYS_SETGROUPS
-)
+const _SYS_setgroups = SYS_SETGROUPS
 
 //sys  Dup2(oldfd int, newfd int) (err error)
 //sysnb        EpollCreate(size int) (fd int, err error)
index 61e9c60e70e915f72948ed036bfaae1da8bec71d..d54bd38510eee50d65ba9f5c935d64f753680e1c 100644 (file)
@@ -6,10 +6,7 @@ package syscall
 
 import "unsafe"
 
-const (
-       _SYS_dup       = SYS_DUP3
-       _SYS_setgroups = SYS_SETGROUPS
-)
+const _SYS_setgroups = SYS_SETGROUPS
 
 func EpollCreate(size int) (fd int, err error) {
        if size <= 0 {
index fcedf5909a4e220c2f930f26045aadd1a7049563..80cb1ccc19ed86f87116f0ddb909344098b9a9a4 100644 (file)
@@ -6,10 +6,7 @@ package syscall
 
 import "unsafe"
 
-const (
-       _SYS_dup       = SYS_DUP2
-       _SYS_setgroups = SYS_SETGROUPS
-)
+const _SYS_setgroups = SYS_SETGROUPS
 
 //sys  Dup2(oldfd int, newfd int) (err error)
 //sysnb        EpollCreate(size int) (fd int, err error)