aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2016-11-09 20:35:46 +0000
committerBrad Fitzpatrick <bradfitz@golang.org>2016-11-09 21:50:55 +0000
commit22c70f268b30c703856143df848556515a824071 (patch)
tree2b6bf9ef47ddfdb01b382ef7d12d91c811cbec86
parent48c6048e554ff4f428aefd41b9345ed5ec634783 (diff)
downloadgo-22c70f268b30c703856143df848556515a824071.tar.gz
go-22c70f268b30c703856143df848556515a824071.zip
syscall: use 32-bit setuid/setgid syscalls on linux/{386,arm}
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>
-rw-r--r--src/syscall/exec_linux.go4
-rw-r--r--src/syscall/setuidgid_32_linux.go13
-rw-r--r--src/syscall/setuidgid_linux.go13
3 files changed, 28 insertions, 2 deletions
diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go
index b0cad52f7b..979b6a247a 100644
--- a/src/syscall/exec_linux.go
+++ b/src/syscall/exec_linux.go
@@ -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
index 0000000000..182f5d26a9
--- /dev/null
+++ b/src/syscall/setuidgid_32_linux.go
@@ -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
index 0000000000..bf40d2d882
--- /dev/null
+++ b/src/syscall/setuidgid_linux.go
@@ -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
+)