]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: use 32-bit setuid/setgid syscalls on linux/{386,arm}
authorBrad Fitzpatrick <bradfitz@golang.org>
Wed, 9 Nov 2016 20:35:46 +0000 (20:35 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 9 Nov 2016 21:50:55 +0000 (21:50 +0000)
Fixes #17092

Change-Id: Ib14e4db13116ebbe4d72c414fb979d27a06d6174
Reviewed-on: https://go-review.googlesource.com/33011
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/syscall/exec_linux.go
src/syscall/setuidgid_32_linux.go [new file with mode: 0644]
src/syscall/setuidgid_linux.go [new file with mode: 0644]

index b0cad52f7bdf91898900ad99b9f34c75804dd069..979b6a247a66821ce3a6477fa91e5e22765f5c27 100644 (file)
@@ -219,11 +219,11 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
                                goto childerror
                        }
                }
-               _, _, err1 = RawSyscall(SYS_SETGID, uintptr(cred.Gid), 0, 0)
+               _, _, err1 = RawSyscall(sys_SETGID, uintptr(cred.Gid), 0, 0)
                if err1 != 0 {
                        goto childerror
                }
-               _, _, err1 = RawSyscall(SYS_SETUID, uintptr(cred.Uid), 0, 0)
+               _, _, err1 = RawSyscall(sys_SETUID, uintptr(cred.Uid), 0, 0)
                if err1 != 0 {
                        goto childerror
                }
diff --git a/src/syscall/setuidgid_32_linux.go b/src/syscall/setuidgid_32_linux.go
new file mode 100644 (file)
index 0000000..182f5d2
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2016 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 linux
+// +build 386 arm
+
+package syscall
+
+const (
+       sys_SETGID = SYS_SETGID32
+       sys_SETUID = SYS_SETUID32
+)
diff --git a/src/syscall/setuidgid_linux.go b/src/syscall/setuidgid_linux.go
new file mode 100644 (file)
index 0000000..bf40d2d
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2016 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 linux
+// +build !386,!arm
+
+package syscall
+
+const (
+       sys_SETGID = SYS_SETGID
+       sys_SETUID = SYS_SETUID
+)