Open
Description
What version of Go are you using (go version
)?
$ go version >go version go1.15.1
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env running env Kernel version:4.4.131 Architecture: mips64 Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3
What did you do?
package main
import (
"os/exec"
"strconv"
"strings"
"os"
"log"
"time"
)
// Check root rights to use system service
func checkPrivileges() (bool) {
if output, err := exec.Command("id", "-g").Output(); err == nil {
if gid, parseErr := strconv.ParseUint(strings.TrimSpace(string(output)), 10, 32); parseErr == nil {
if gid == 0 {
return true
}
return false
}
} else {
// TODO: This is not true for user services.
return os.Getppid() != 1
}
return false
}
func main(){
log.SetFlags(log.Lshortfile|log.Ltime)
checkPrivileges()
time.Sleep(10*time.Second)
}
CGO_ENABLED=0 GOARCH=mips64le GOMIPS=softfloat GOOS=linux go build command.go
What did you expect to see?
What did you see instead?
fatal error: all goroutines are asleep - deadlock!
goroutine 1 [chan receive]:
os/exec.(*Cmd).Wait(0xc0000c4000, 0x0, 0x0)
/usr/local/go/src/os/exec/exec.go:515 +0x128
os/exec.(*Cmd).Run(0xc0000c4000, 0xc0000c2050, 0x0)
/usr/local/go/src/os/exec/exec.go:341 +0x74
os/exec.(*Cmd).Output(0xc0000c4000, 0x2, 0xc0000a0f58, 0x1, 0x1, 0xc0000c4000)
/usr/local/go/src/os/exec/exec.go:546 +0xa4
main.checkPrivileges(0xc0000c2000)
/root/client/debug/command.go:14 +0x8c
main.main()
/root/client/debug/command.go:30 +0x54
goroutine 19 [IO wait]:
internal/poll.runtime_pollWait(0xffca558d28, 0x72, 0x118420)
/usr/local/go/src/runtime/netpoll.go:220 +0x60
internal/poll.(*pollDesc).wait(0xc0000be258, 0x72, 0xc000058001, 0x8000, 0x8000)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x50
internal/poll.(*pollDesc).waitRead(...)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc0000be240, 0xc000058000, 0x8000, 0x8000, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:159 +0x1c4
os.(*File).read(...)
/usr/local/go/src/os/file_posix.go:31
os.(*File).Read(0xc0000bc038, 0xc000058000, 0x8000, 0x8000, 0x0, 0x0, 0x0)
/usr/local/go/src/os/file.go:116 +0x7c
io.copyBuffer(0x1183a0, 0xc0000c2050, 0x1182e0, 0xc0000bc038, 0xc000058000, 0x8000, 0x8000, 0x0, 0x0, 0x0)
/usr/local/go/src/io/io.go:409 +0x108
io.Copy(...)
/usr/local/go/src/io/io.go:368
os/exec.(*Cmd).writerDescriptor.func1(0x0, 0x0)
/usr/local/go/src/os/exec/exec.go:311 +0x70
os/exec.(*Cmd).Start.func1(0xc0000c4000, 0xc0000ae0c0)
/usr/local/go/src/os/exec/exec.go:441 +0x3c
created by os/exec.(*Cmd).Start
/usr/local/go/src/os/exec/exec.go:440 +0x454
Metadata
Metadata
Assignees
Labels
Type
Projects
Status