I think that golang on Linux ARM is inappropriately using the 16bit variant
of the setgroups syscall when using exec.
I've been having problems with setting additional groups on a Linux ARM
system with a statement like this:
groups = []uint32{20, 21}
cmd.SysProcAttr.Credential = &syscall.Credential{Groups: groups}
cmd.Run()
If I run strace on the process, I see this syscall:
setgroups(2, [20, 0])
I did some experiments and discovered that the syscall is treating groups
as a uint16 array despite the Groups slice in golang being uint32.
groups = []uint32{1310740, 1376277, 0, 0} //20,20,21,21,0,0,0,0
gives a strace result of:
setgroups(4, [20, 20, 21, 21])
I tracked it down to this line in exec_linux.go:
_, _, err1 = RawSyscall(SYS_SETGROUPS, ngroups, groups, 0)
That's the 16bit syscall. In zsyscall_linux_arm.go setgroups() uses the
32bit:
_, _, e1 := RawSyscall(SYS_SETGROUPS32, uintptr(n),
uintptr(unsafe.Pointer(list)), 0)
Since, the syscall.Credential.Group field is explicitly a uint32 in linux,
why would the 16bit version be in use? Why not use the already properly
defined syscall.setgroups()? Am I missing something?
Thanks,
Chris
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.