]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: for ForkExec on Linux, always use 32-bit setgroups system call
authorRuss Cox <rsc@golang.org>
Wed, 19 Oct 2016 02:56:14 +0000 (22:56 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 19 Oct 2016 13:33:18 +0000 (13:33 +0000)
Fixes #17092.

Change-Id: If203d802a919e00594ddc1282782fc59a083fd63
Reviewed-on: https://go-review.googlesource.com/31458
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/syscall/exec_linux.go
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_ppc64x.go
src/syscall/syscall_linux_s390x.go

index 39764f707637453bd4769607e182e2231a9aa248..b0cad52f7bdf91898900ad99b9f34c75804dd069 100644 (file)
@@ -214,7 +214,7 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
                // and disabled setgroups, because otherwise unprivileged user namespace
                // will fail with any non-empty SysProcAttr.Credential.
                if !(sys.GidMappings != nil && !sys.GidMappingsEnableSetgroups && ngroups == 0) {
-                       _, _, err1 = RawSyscall(SYS_SETGROUPS, ngroups, groups, 0)
+                       _, _, err1 = RawSyscall(_SYS_setgroups, ngroups, groups, 0)
                        if err1 != 0 {
                                goto childerror
                        }
index c8339e909aba891d5e3a2df8def44c1d2b573057..00cf262738dacb3ea7e331b5a2f0aa80d3b16dd6 100644 (file)
@@ -10,8 +10,9 @@ package syscall
 import "unsafe"
 
 const (
-       _SYS_dup      = SYS_DUP2
-       _SYS_getdents = SYS_GETDENTS64
+       _SYS_dup       = SYS_DUP2
+       _SYS_getdents  = SYS_GETDENTS64
+       _SYS_setgroups = SYS_SETGROUPS32
 )
 
 func setTimespec(sec, nsec int64) Timespec {
index 684bd9cd05bd4ed94e7c4859dace6bc23614b08d..0184d7d850b377365e5d4b3ecd037f8d79774d7c 100644 (file)
@@ -5,8 +5,9 @@
 package syscall
 
 const (
-       _SYS_dup      = SYS_DUP2
-       _SYS_getdents = SYS_GETDENTS64
+       _SYS_dup       = SYS_DUP2
+       _SYS_getdents  = SYS_GETDENTS64
+       _SYS_setgroups = SYS_SETGROUPS
 )
 
 //sys  Dup2(oldfd int, newfd int) (err error)
index 6371169382b2830e7f0f6d052fe694961a3080a4..2ed31f0bb93161463b9dfab1588597ce22a4ae9f 100644 (file)
@@ -7,8 +7,9 @@ package syscall
 import "unsafe"
 
 const (
-       _SYS_dup      = SYS_DUP2
-       _SYS_getdents = SYS_GETDENTS64
+       _SYS_dup       = SYS_DUP2
+       _SYS_getdents  = SYS_GETDENTS64
+       _SYS_setgroups = SYS_SETGROUPS32
 )
 
 func setTimespec(sec, nsec int64) Timespec {
index 0903ba3ecee5d351ba549a89946b04f4bdc671af..4462139c8b3376cf769c9231a3133a8ca667bfbe 100644 (file)
@@ -5,8 +5,9 @@
 package syscall
 
 const (
-       _SYS_dup      = SYS_DUP3
-       _SYS_getdents = SYS_GETDENTS64
+       _SYS_dup       = SYS_DUP3
+       _SYS_getdents  = SYS_GETDENTS64
+       _SYS_setgroups = SYS_SETGROUPS
 )
 
 //sys  Fchown(fd int, uid int, gid int) (err error)
index f203156f2bc7b83e0b37c24c53d3833d0aa64ba9..9fd7982d2fcc3d78d3f54ca0caa0315d443080a7 100644 (file)
@@ -15,7 +15,8 @@ const (
        // to support older kernels, we have to use getdents for mips64.
        // Also note that struct dirent is different for these two.
        // Lookup linux_dirent{,64} in kernel source code for details.
-       _SYS_getdents = SYS_GETDENTS
+       _SYS_getdents  = SYS_GETDENTS
+       _SYS_setgroups = SYS_SETGROUPS
 )
 
 //sys  Dup2(oldfd int, newfd int) (err error)
index 006889c5e3024d8135f4dd4631097f51c19533c3..307abc9f53d287ae6be533f78faef06f1d3ee1f6 100644 (file)
@@ -8,8 +8,9 @@
 package syscall
 
 const (
-       _SYS_dup      = SYS_DUP2
-       _SYS_getdents = SYS_GETDENTS64
+       _SYS_dup       = SYS_DUP2
+       _SYS_getdents  = SYS_GETDENTS64
+       _SYS_setgroups = SYS_SETGROUPS
 )
 
 //sys  Dup2(oldfd int, newfd int) (err error)
index fea6c205083ffe3b0b462f49fbd080356341c711..148790e7566f6324c4404d9210b518cf6afbd937 100644 (file)
@@ -7,8 +7,9 @@ package syscall
 import "unsafe"
 
 const (
-       _SYS_dup      = SYS_DUP2
-       _SYS_getdents = SYS_GETDENTS64
+       _SYS_dup       = SYS_DUP2
+       _SYS_getdents  = SYS_GETDENTS64
+       _SYS_setgroups = SYS_SETGROUPS
 )
 
 //sys  Dup2(oldfd int, newfd int) (err error)