Skip to content

Commit 22c70f2

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 48c6048 commit 22c70f2

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

src/syscall/exec_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,11 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
219219
goto childerror
220220
}
221221
}
222-
_, _, err1 = RawSyscall(SYS_SETGID, uintptr(cred.Gid), 0, 0)
222+
_, _, err1 = RawSyscall(sys_SETGID, uintptr(cred.Gid), 0, 0)
223223
if err1 != 0 {
224224
goto childerror
225225
}
226-
_, _, err1 = RawSyscall(SYS_SETUID, uintptr(cred.Uid), 0, 0)
226+
_, _, err1 = RawSyscall(sys_SETUID, uintptr(cred.Uid), 0, 0)
227227
if err1 != 0 {
228228
goto childerror
229229
}

src/syscall/setuidgid_32_linux.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2016 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
// +build linux
6+
// +build 386 arm
7+
8+
package syscall
9+
10+
const (
11+
sys_SETGID = SYS_SETGID32
12+
sys_SETUID = SYS_SETUID32
13+
)

src/syscall/setuidgid_linux.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2016 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
// +build linux
6+
// +build !386,!arm
7+
8+
package syscall
9+
10+
const (
11+
sys_SETGID = SYS_SETGID
12+
sys_SETUID = SYS_SETUID
13+
)

0 commit comments

Comments
 (0)