Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.13 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/bubun/snap/code/common/.cache/go-build" GOENV="/home/bubun/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/bubun/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build673698735=/tmp/go-build -gno-record-gcc-switches"
What did you do?
I have a simple Go Program Which calls
syscall.RawSyscall(syscall.SYS_PTRACE, uintptr(syscall.PTRACE_TRACEME), 0, 0)
to check if a debugger is being used or not. But after a bit, I found a very strange behavior with it.
when calling using sudo.
whenever I am trying to run an external program by calling
exec.Command()
the whole code just hanging up without any error or output. I have prepared a simple Programm to recreate the problem
Download it:
example.zip
example.zip:
| run.sh
| strace.sh
| test.go
just run run.sh it will ask for sudo. Just enter the password and see the result.
What did you expect to see?
bubun@ubuntu:~/Desktop/strace-test$ ./run.sh
[sudo] password for bubun:
Not Being Traced
Executing a command in Go
What did you see instead?
bubun@ubuntu:~/Desktop/strace-test$ ./run.sh
[sudo] password for bubun:
Not Being Traced
<< === The Executable Hunging Up Without Any Output or error