Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGSEGV: segmentation violation code=0x1 - help #49992

Closed
cranzy opened this issue Dec 6, 2021 · 17 comments
Closed

SIGSEGV: segmentation violation code=0x1 - help #49992

cranzy opened this issue Dec 6, 2021 · 17 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@cranzy
Copy link

cranzy commented Dec 6, 2021

What version of Go are you using (go version)?

$ go version
go version go1.17.4 darwin/amd64

Does this issue reproduce with the latest release?

I get it both on 1.17.3 and 1.17.4

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/dimitardimitrov/Library/Caches/go-build"
GOENV="/Users/dimitardimitrov/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/dimitardimitrov/Desktop/repos/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/dimitardimitrov/Desktop/repos"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.4"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/dimitardimitrov/Desktop/repos/testkit/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/nc/qtdpw1z10mn5glqqw556z53c0000gn/T/go-build2059822728=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Basically building locally a go binary. The binary that I produce is working on other people's MacOS machines but not on mine.
The way the binary is build is standard GOOS=$(1) GOARCH=$(2) go build where GOOS is darwin and GOARCH is amd64.

What did you expect to see?

Running go binary

What did you see instead?

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb01dfacedebac1e pc=0x7fff2050bc9e]

runtime stack:
runtime: unexpected return pc for runtime.sigpanic called from 0x7fff2050bc9e
stack: frame={sp:0x700003715e58, fp:0x700003715ea8} stack=[0x700003696338,0x700003715f38)
0x0000700003715d58:  0x0100700003715d78  0x0000000000000004 
0x0000700003715d68:  0x000000000000001f  0x00007fff2050bc9e 
0x0000700003715d78:  0x0b01dfacedebac1e  0x0000000000000001 
0x0000700003715d88:  0x0000000004034b31   0x0000700003715e28 
0x0000700003715d98:  0x0000000005950d37  0x0000700003715de0 
0x0000700003715da8:  0x0000000004034de8   0x000000c0005921a0 
0x0000700003715db8:  0x0000000000000001  0x0000000000000001 
0x0000700003715dc8:  0x0000700003715e28  0x0000000004034b31  
0x0000700003715dd8:  0x000000c0005921a0  0x0000700003715e18 
0x0000700003715de8:  0x0000000004034d70   0x0000700003715df8 
0x0000700003715df8:  0x0000000004034da0   0x000000c0005921a0 
0x0000700003715e08:  0x0000000004034b31   0x0000700003715e28 
0x0000700003715e18:  0x0000700003715e48  0x0000000004034b31  
0x0000700003715e28:  0x0000700003715e30  0x0000000004034b60  
0x0000700003715e38:  0x0000000005972c8d  0x000000000000002a 
0x0000700003715e48:  0x0000700003715e98  0x000000000404a8b6  
0x0000700003715e58: <0x0000000005972c8d  0x000000c000716000 
0x0000700003715e68:  0x0000700003715ed8  0x00000000040278c6  
0x0000700003715e78:  0x000000c0008a82c8  0x0000000004593649  
0x0000700003715e88:  0x000000c0000001a0  0x0000000000000000 
0x0000700003715e98:  0x0000700003715ee0 !0x00007fff2050bc9e 
0x0000700003715ea8: >0x0000700003715ee0  0x0000000006ad0000 
0x0000700003715eb8:  0x0000000000000564  0x00000000042e0365  
0x0000700003715ec8:  0x0000000004067bdf   0x000000c0008a8ec0 
0x0000700003715ed8:  0x000000000406754c   0x000000c0008a8e90 
0x0000700003715ee8:  0x0000000004065a50   0x0000700003715f20 
0x0000700003715ef8:  0x000000000400ec0e   0x0000000000001018 
0x0000700003715f08:  0x000000c0005921a0  0x0000000006c3dd58 
0x0000700003715f18:  0x0000000000001198  0x000000c0000001a0 
0x0000700003715f28:  0x0000000004063b69   0x0000700003715f50 
runtime.throw({0x5972c8d, 0xc000716000})
	/usr/local/go/src/runtime/panic.go:1198 +0x71
runtime: unexpected return pc for runtime.sigpanic called from 0x7fff2050bc9e
stack: frame={sp:0x700003715e58, fp:0x700003715ea8} stack=[0x700003696338,0x700003715f38)
0x0000700003715d58:  0x0100700003715d78  0x0000000000000004 
0x0000700003715d68:  0x000000000000001f  0x00007fff2050bc9e 
0x0000700003715d78:  0x0b01dfacedebac1e  0x0000000000000001 
0x0000700003715d88:  0x0000000004034b31   0x0000700003715e28 
0x0000700003715d98:  0x0000000005950d37  0x0000700003715de0 
0x0000700003715da8:  0x0000000004034de8   0x000000c0005921a0 
0x0000700003715db8:  0x0000000000000001  0x0000000000000001 
0x0000700003715dc8:  0x0000700003715e28  0x0000000004034b31  
0x0000700003715dd8:  0x000000c0005921a0  0x0000700003715e18 
0x0000700003715de8:  0x0000000004034d70   0x0000700003715df8 
0x0000700003715df8:  0x0000000004034da0   0x000000c0005921a0 
0x0000700003715e08:  0x0000000004034b31   0x0000700003715e28 
0x0000700003715e18:  0x0000700003715e48  0x0000000004034b31  
0x0000700003715e28:  0x0000700003715e30  0x0000000004034b60  
0x0000700003715e38:  0x0000000005972c8d  0x000000000000002a 
0x0000700003715e48:  0x0000700003715e98  0x000000000404a8b6  
0x0000700003715e58: <0x0000000005972c8d  0x000000c000716000 
0x0000700003715e68:  0x0000700003715ed8  0x00000000040278c6  
0x0000700003715e78:  0x000000c0008a82c8  0x0000000004593649  
0x0000700003715e88:  0x000000c0000001a0  0x0000000000000000 
0x0000700003715e98:  0x0000700003715ee0 !0x00007fff2050bc9e 
0x0000700003715ea8: >0x0000700003715ee0  0x0000000006ad0000 
0x0000700003715eb8:  0x0000000000000564  0x00000000042e0365  
0x0000700003715ec8:  0x0000000004067bdf   0x000000c0008a8ec0 
0x0000700003715ed8:  0x000000000406754c   0x000000c0008a8e90 
0x0000700003715ee8:  0x0000000004065a50   0x0000700003715f20 
0x0000700003715ef8:  0x000000000400ec0e   0x0000000000001018 
0x0000700003715f08:  0x000000c0005921a0  0x0000000006c3dd58 
0x0000700003715f18:  0x0000000000001198  0x000000c0000001a0 
0x0000700003715f28:  0x0000000004063b69   0x0000700003715f50 
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:719 +0x396

goroutine 1 [syscall]:
syscall.syscall(0x42e0360, 0x2, 0x40487413, 0xc0008a8f50)
	/usr/local/go/src/runtime/sys_darwin.go:22 +0x3b fp=0xc0008a8ec0 sp=0xc0008a8ea0 pc=0x406245b
syscall.syscall(0x38, 0x8, 0x38, 0xc0007c0000)
	:1 +0x26 fp=0xc0008a8f08 sp=0xc0008a8ec0 pc=0x40683a6
golang.org/x/sys/unix.ioctl(0xc0005f4240, 0xc0008a9048, 0x10)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/golang.org/x/sys@v0.0.0-20210124154548-22da62e12c0c/unix/zsyscall_darwin_amd64.go:689 +0x39 fp=0xc0008a8f38 sp=0xc0008a8f08 pc=0x42dfeb9
golang.org/x/sys/unix.IoctlGetTermios(...)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/golang.org/x/sys@v0.0.0-20210124154548-22da62e12c0c/unix/ioctl.go:72
golang.org/x/crypto/ssh/terminal.IsTerminal(0x400e494)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/golang.org/x/crypto@v0.0.0-20200622213623-75b288015ac9/ssh/terminal/util.go:30 +0x50 fp=0xc0008a8fa8 sp=0xc0008a8f38 pc=0x42e0650
github.com/Sirupsen/logrus.checkIfTerminal({0x5c33640, 0xc000130010})
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/terminal_check_notappengine.go:15 +0x75 fp=0xc0008a8fc0 sp=0xc0008a8fa8 pc=0x42e6735
github.com/Sirupsen/logrus.(*TextFormatter).init(...)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/text_formatter.go:86
github.com/Sirupsen/logrus.(*TextFormatter).Format.func1()
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/text_formatter.go:169 +0x3b fp=0xc0008a8ff0 sp=0xc0008a8fc0 pc=0x42e7cfb
sync.(*Once).doSlow(0x5c50aa8, 0xc00070b230)
	/usr/local/go/src/sync/once.go:68 +0xd2 fp=0xc0008a9058 sp=0xc0008a8ff0 pc=0x406f0b2
sync.(*Once).Do(...)
	/usr/local/go/src/sync/once.go:59
github.com/Sirupsen/logrus.(*TextFormatter).Format(0xc0001482d0, 0xc0004fc460)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/text_formatter.go:169 +0xde5 fp=0xc0008a95b0 sp=0xc0008a9058 pc=0x42e76a5
github.com/Sirupsen/logrus.(*Entry).write(0xc0004fc460)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/entry.go:256 +0xa5 fp=0xc0008a9628 sp=0xc0008a95b0 pc=0x42e1fe5
github.com/Sirupsen/logrus.Entry.log({0xc000161e30, 0xc000261bf0, {0x0, 0x0, 0x0}, 0x0, 0x0, {0x0, 0x0}, 0x0, ...}, ...)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/entry.go:232 +0x22e fp=0xc0008a96a8 sp=0xc0008a9628 pc=0x42e1c8e
github.com/Sirupsen/logrus.(*Entry).Log(0xc000370540, 0x4, {0xc0008a97d8, 0x1, 0x1})
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/entry.go:269 +0xa8 fp=0xc0008a97b0 sp=0xc0008a96a8 pc=0x42e21e8
github.com/Sirupsen/logrus.(*Entry).Logf(0xc000370540, 0x4, {0x5925327, 0x400bde7}, {0xc00013c1c0, 0x5396020, 0x203001})
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/entry.go:315 +0x85 fp=0xc0008a97f8 sp=0xc0008a97b0 pc=0x42e2765
github.com/Sirupsen/logrus.(*Entry).Infof(0xc00004a0a0, {0x5925327, 0x0}, {0xc00013c1c0, 0x203000, 0x203000})
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/entry.go:328 +0x37 fp=0xc0008a9840 sp=0xc0008a97f8 pc=0x42e2937
github.com/Mirantis/testkit/cmd/testkit.newCreateCommand.func1.1(0xc0001b9080, 0xc000382b80, {0x5c65c78, 0x6c39510}, 0xc000388780, 0x1)
	/Users/dimitardimitrov/Desktop/repos/testkit/cmd/testkit/create.go:238 +0x104 fp=0xc0008a9b90 sp=0xc0008a9840 pc=0x519e064
github.com/Mirantis/testkit/cmd/testkit.newCreateCommand.func1(0xc0001cfb80, {0xc000475bc0, 0x2, 0x2})
	/Users/dimitardimitrov/Desktop/repos/testkit/cmd/testkit/create.go:337 +0xbe5 fp=0xc0008a9d78 sp=0xc0008a9b90 pc=0x519dba5
github.com/spf13/cobra.(*Command).execute(0xc0001cfb80, {0xc000475b80, 0x2, 0x2})
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:826 +0x60e fp=0xc0008a9e38 sp=0xc0008a9d78 pc=0x502400e
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001cec80)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x2fc fp=0xc0008a9ef0 sp=0xc0008a9e38 pc=0x502453c
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
main.main()
	/Users/dimitardimitrov/Desktop/repos/testkit/main.go:39 +0x20b fp=0xc0008a9f80 sp=0xc0008a9ef0 pc=0x51a918b
runtime.main()
	/usr/local/go/src/runtime/proc.go:255 +0x227 fp=0xc0008a9fe0 sp=0xc0008a9f80 pc=0x40371c7
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc0008a9fe8 sp=0xc0008a9fe0 pc=0x4065d41

goroutine 6 [select]:
go.opencensus.io/stats/view.(*worker).start(0xc00035a050)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/go.opencensus.io@v0.22.0/stats/view/worker.go:154 +0xb9
created by go.opencensus.io/stats/view.init.0
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/go.opencensus.io@v0.22.0/stats/view/worker.go:32 +0x87

goroutine 7 [chan receive]:
github.com/golang/glog.(*loggingT).flushDaemon(0x0)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/glog.go:882 +0x6a
created by github.com/golang/glog.init.0
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/glog.go:410 +0x1c5

goroutine 23 [syscall]:
os/signal.signal_recv()
	/usr/local/go/src/runtime/sigqueue.go:166 +0x28
os/signal.loop()
	/usr/local/go/src/os/signal/signal_unix.go:24 +0x19
created by os/signal.Notify.func1.1
	/usr/local/go/src/os/signal/signal.go:151 +0x2c

goroutine 24 [select]:
github.com/Mirantis/testkit/cmd/testkit.NewTestkitCommand.func1.1()
	/Users/dimitardimitrov/Desktop/repos/testkit/cmd/testkit/root.go:92 +0x77
created by github.com/Mirantis/testkit/cmd/testkit.NewTestkitCommand.func1
	/Users/dimitardimitrov/Desktop/repos/testkit/cmd/testkit/root.go:91 +0x525

goroutine 66 [IO wait]:
internal/poll.runtime_pollWait(0x10202108, 0x72)
	/usr/local/go/src/runtime/netpoll.go:234 +0x89
internal/poll.(*pollDesc).wait(0xc0007c6800, 0xc0006a0000, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x32
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc0007c6800, {0xc0006a0000, 0x17c4, 0x17c4})
	/usr/local/go/src/internal/poll/fd_unix.go:167 +0x25a
net.(*netFD).Read(0xc0007c6800, {0xc0006a0000, 0xc0006a000d, 0x167})
	/usr/local/go/src/net/fd_posix.go:56 +0x29
net.(*conn).Read(0xc0005d6000, {0xc0006a0000, 0x17b7, 0xc0000797f8})
	/usr/local/go/src/net/net.go:183 +0x45
crypto/tls.(*atLeastReader).Read(0xc00022c078, {0xc0006a0000, 0x0, 0x400b08d})
	/usr/local/go/src/crypto/tls/conn.go:777 +0x3d
bytes.(*Buffer).ReadFrom(0xc0005da278, {0x5c2f5a0, 0xc00022c078})
	/usr/local/go/src/bytes/buffer.go:204 +0x98
crypto/tls.(*Conn).readFromUntil(0xc0005da000, {0x102c0008, 0xc0005d6000}, 0x8c4b500)
	/usr/local/go/src/crypto/tls/conn.go:799 +0xe5
crypto/tls.(*Conn).readRecordOrCCS(0xc0005da000, 0x0)
	/usr/local/go/src/crypto/tls/conn.go:606 +0x112
crypto/tls.(*Conn).readRecord(...)
	/usr/local/go/src/crypto/tls/conn.go:574
crypto/tls.(*Conn).Read(0xc0005da000, {0xc0007e9000, 0x1000, 0x1})
	/usr/local/go/src/crypto/tls/conn.go:1277 +0x16f
net/http.(*persistConn).Read(0xc0007fa120, {0xc0007e9000, 0xc000240060, 0xc000079d30})
	/usr/local/go/src/net/http/transport.go:1926 +0x4e
bufio.(*Reader).fill(0xc00030a000)
	/usr/local/go/src/bufio/bufio.go:101 +0x103
bufio.(*Reader).Peek(0xc00030a000, 0x1)
	/usr/local/go/src/bufio/bufio.go:139 +0x5d
net/http.(*persistConn).readLoop(0xc0007fa120)
	/usr/local/go/src/net/http/transport.go:2087 +0x1ac
created by net/http.(*Transport).dialConn
	/usr/local/go/src/net/http/transport.go:1747 +0x1e05

goroutine 67 [select]:
net/http.(*persistConn).writeLoop(0xc0007fa120)
	/usr/local/go/src/net/http/transport.go:2386 +0xfb
created by net/http.(*Transport).dialConn
	/usr/local/go/src/net/http/transport.go:1748 +0x1e65

@seankhliao
Copy link
Member

macos version?
and was this binary built with -race?

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 6, 2021
@sivavikneshs
Copy link

sivavikneshs commented Dec 6, 2021

I am also facing similar issue

go version go1.17.2 darwin/amd64

OSX version - 10.15.7

`fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb01dfacedebac1e pc=0x7fff6c71270a]

runtime stack:
runtime: unexpected return pc for runtime.sigpanic called from 0x7fff6c71270a
stack: frame={sp:0x70000cdb7e48, fp:0x70000cdb7e98} stack=[0x70000cd38328,0x70000cdb7f28)
0x000070000cdb7d48: 0x010070000cdb7d68 0x0000000000000004
0x000070000cdb7d58: 0x000000000000001f 0x00007fff6c71270a
0x000070000cdb7d68: 0x0b01dfacedebac1e 0x0000000000000001
0x000070000cdb7d78: 0x0000000004036351 <runtime.throw+0x0000000000000071> 0x000070000cdb7e18
0x000070000cdb7d88: 0x000000000442416c 0x000070000cdb7dd0
0x000070000cdb7d98: 0x0000000004036608 <runtime.fatalthrow.func1+0x0000000000000048> 0x000000c000001520
0x000070000cdb7da8: 0x0000000000000001 0x0000000000000001
0x000070000cdb7db8: 0x000070000cdb7e18 0x0000000004036351 <runtime.throw+0x0000000000000071>
0x000070000cdb7dc8: 0x000000c000001520 0x000070000cdb7e08
0x000070000cdb7dd8: 0x0000000004036590 <runtime.fatalthrow+0x0000000000000050> 0x000070000cdb7de8
0x000070000cdb7de8: 0x00000000040365c0 <runtime.fatalthrow.func1+0x0000000000000000> 0x000000c000001520
0x000070000cdb7df8: 0x0000000004036351 <runtime.throw+0x0000000000000071> 0x000070000cdb7e18
0x000070000cdb7e08: 0x000070000cdb7e38 0x0000000004036351 <runtime.throw+0x0000000000000071>
0x000070000cdb7e18: 0x000070000cdb7e20 0x0000000004036380 <runtime.throw.func1+0x0000000000000000>
0x000070000cdb7e28: 0x0000000004426b8c 0x000000000000002a
0x000070000cdb7e38: 0x000070000cdb7e88 0x000000000404be76 <runtime.sigpanic+0x0000000000000396>
0x000070000cdb7e48: <0x0000000004426b8c 0x0000000000000048
0x000070000cdb7e58: 0x000000010007e300 0x0000000004429498
0x000070000cdb7e68: 0x0000000000000000 0x0000000000000000
0x000070000cdb7e78: 0x000000c000029698 0x000070000cdb7ed8
0x000070000cdb7e88: 0x000070000cdb7ed0 !0x00007fff6c71270a
0x000070000cdb7e98: >0x000070000cdb7ed0 0x00000000045a8000
0x000070000cdb7ea8: 0x0000000000000557 0x00000000041038c5 <golang.org/x/sys/unix.libc_ioctl_trampoline+0x0000000000000005>
0x000070000cdb7eb8: 0x000000000406819f <runtime.syscall+0x000000000000001f> 0x000000c00012bc98
0x000070000cdb7ec8: 0x0000000004d110a8 0x000000c00012bc68
0x000070000cdb7ed8: 0x0000000004066030 <runtime.asmcgocall+0x0000000000000070> 0x000000000401bef5 <runtime.SetFinalizer.func2+0x0000000000000035>
0x000070000cdb7ee8: 0x000000c00007e300 0x0000000004429498
0x000070000cdb7ef8: 0x0000000000000010 0x00000000043fbaa0
0x000070000cdb7f08: 0x00000000000003c0 0x000000c0000001a0
0x000070000cdb7f18: 0x0000000004064149 <runtime.systemstack+0x0000000000000049> 0x000070000cdb7f40
runtime.throw({0x4426b8c, 0x48})
/usr/local/Cellar/go/1.17.2/libexec/src/runtime/panic.go:1198 +0x71
runtime: unexpected return pc for runtime.sigpanic called from 0x7fff6c71270a
stack: frame={sp:0x70000cdb7e48, fp:0x70000cdb7e98} stack=[0x70000cd38328,0x70000cdb7f28)
0x000070000cdb7d48: 0x010070000cdb7d68 0x0000000000000004
0x000070000cdb7d58: 0x000000000000001f 0x00007fff6c71270a
0x000070000cdb7d68: 0x0b01dfacedebac1e 0x0000000000000001
0x000070000cdb7d78: 0x0000000004036351 <runtime.throw+0x0000000000000071> 0x000070000cdb7e18
0x000070000cdb7d88: 0x000000000442416c 0x000070000cdb7dd0
0x000070000cdb7d98: 0x0000000004036608 <runtime.fatalthrow.func1+0x0000000000000048> 0x000000c000001520
0x000070000cdb7da8: 0x0000000000000001 0x0000000000000001
0x000070000cdb7db8: 0x000070000cdb7e18 0x0000000004036351 <runtime.throw+0x0000000000000071>
0x000070000cdb7dc8: 0x000000c000001520 0x000070000cdb7e08
0x000070000cdb7dd8: 0x0000000004036590 <runtime.fatalthrow+0x0000000000000050> 0x000070000cdb7de8
0x000070000cdb7de8: 0x00000000040365c0 <runtime.fatalthrow.func1+0x0000000000000000> 0x000000c000001520
0x000070000cdb7df8: 0x0000000004036351 <runtime.throw+0x0000000000000071> 0x000070000cdb7e18
0x000070000cdb7e08: 0x000070000cdb7e38 0x0000000004036351 <runtime.throw+0x0000000000000071>
0x000070000cdb7e18: 0x000070000cdb7e20 0x0000000004036380 <runtime.throw.func1+0x0000000000000000>
0x000070000cdb7e28: 0x0000000004426b8c 0x000000000000002a
0x000070000cdb7e38: 0x000070000cdb7e88 0x000000000404be76 <runtime.sigpanic+0x0000000000000396>
0x000070000cdb7e48: <0x0000000004426b8c 0x0000000000000048
0x000070000cdb7e58: 0x000000010007e300 0x0000000004429498
0x000070000cdb7e68: 0x0000000000000000 0x0000000000000000
0x000070000cdb7e78: 0x000000c000029698 0x000070000cdb7ed8
0x000070000cdb7e88: 0x000070000cdb7ed0 !0x00007fff6c71270a
0x000070000cdb7e98: >0x000070000cdb7ed0 0x00000000045a8000
0x000070000cdb7ea8: 0x0000000000000557 0x00000000041038c5 <golang.org/x/sys/unix.libc_ioctl_trampoline+0x0000000000000005>
0x000070000cdb7eb8: 0x000000000406819f <runtime.syscall+0x000000000000001f> 0x000000c00012bc98
0x000070000cdb7ec8: 0x0000000004d110a8 0x000000c00012bc68
0x000070000cdb7ed8: 0x0000000004066030 <runtime.asmcgocall+0x0000000000000070> 0x000000000401bef5 <runtime.SetFinalizer.func2+0x0000000000000035>
0x000070000cdb7ee8: 0x000000c00007e300 0x0000000004429498
0x000070000cdb7ef8: 0x0000000000000010 0x00000000043fbaa0
0x000070000cdb7f08: 0x00000000000003c0 0x000000c0000001a0
0x000070000cdb7f18: 0x0000000004064149 <runtime.systemstack+0x0000000000000049> 0x000070000cdb7f40
runtime.sigpanic()
/usr/local/Cellar/go/1.17.2/libexec/src/runtime/signal_unix.go:719 +0x396

goroutine 1 [syscall]:
syscall.syscall(0x41038c0, 0x3, 0x40487413, 0xc00012bd28)
/usr/local/Cellar/go/1.17.2/libexec/src/runtime/sys_darwin.go:22 +0x3b fp=0xc00012bc98 sp=0xc00012bc78 pc=0x4062d7b
syscall.syscall(0xc00012bd38, 0x40a831e, 0x3, 0x441e3e0)
:1 +0x26 fp=0xc00012bce0 sp=0xc00012bc98 pc=0x40688c6
golang.org/x/sys/unix.ioctl(0x60, 0x4739108, 0x60)
/Users/ssankarasubramanian/code/golang/src/golang.org/x/sys/unix/zsyscall_darwin_amd64.go:746 +0x39 fp=0xc00012bd10 sp=0xc00012bce0 pc=0x4103559
golang.org/x/sys/unix.IoctlGetTermios(...)
/Users/ssankarasubramanian/code/golang/src/golang.org/x/sys/unix/ioctl.go:63
golang.org/x/term.isTerminal(0x441e3e0)
/Users/ssankarasubramanian/code/golang/src/golang.org/x/term/term_unix.go:19 +0x50 fp=0xc00012bd80 sp=0xc00012bd10 pc=0x41039d0
golang.org/x/term.IsTerminal(...)
/Users/ssankarasubramanian/code/golang/src/golang.org/x/term/term.go:26
github.com/gdamore/tcell.NewDevTtyFromDev({0x441e3e0, 0x8})
/Users/ssankarasubramanian/code/golang/src/github.com/gdamore/tcell/tty_unix.go:180 +0x10a fp=0xc00012bdf0 sp=0xc00012bd80 pc=0x4139d4a
`

@cherrymui
Copy link
Member

What version of golang.org/x/sys do you use? Could you try updating your golang.org/x/sys dependency? Thanks.

Maybe a dup of #45702

@cranzy
Copy link
Author

cranzy commented Dec 6, 2021

macos version? and was this binary built with -race?
@seankhliao
MacOS version: Big Sur 11.6.1
No, race detector is not enabled.

@cranzy
Copy link
Author

cranzy commented Dec 6, 2021

What version of golang.org/x/sys do you use? Could you try updating your golang.org/x/sys dependency? Thanks.

Maybe a dup of #45702

The golang.org/x/sys version I was using: golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c
I updated to golang.org/x/sys v0.0.0-20211205182925-97ca703d548d // indirect
and I got the same issue

@cherrymui
Copy link
Member

I updated to golang.org/x/sys v0.0.0-20211205182925-97ca703d548d // indirect
and I got the same issue

Thanks. Then it is not #45702.

Basically building locally a go binary. The binary that I produce is working on other people's MacOS machines but not on mine.

Do you know what's the difference between the machines?

Also, is it reproducible with Go 1.16 ?

pc=0x7fff2050bc9e

The faulting PC is not in the Go binary. It is probably from libSystem or a library that is dynamically linked in. Could you run it in a debugger and print what that address is? Thanks.

@cranzy
Copy link
Author

cranzy commented Dec 6, 2021

@cherrymui

Do you know what's the difference between the machines?

His machine is: MacOS Monterey 12.0.1 with go1.17.3
Mine is: MacOS Big Sur 11.6.1

Also, is it reproducible with Go 1.16 ?

Yes - it's reproducable with go1.16.11 darwin/amd64

Could you run it in a debugger and print what that address is?

Could you give me some more guidance on how to do this? I'm very new to golang. Thank you.

@cherrymui
Copy link
Member

Could you give me some more guidance on how to do this?

Run the binary under lldb, with lldb <binary>. When it faults, in lldb, type bt, enter.

Would it be possible to share the source code of your program and the procedure of reproducing the crash? Thanks.

@cranzy
Copy link
Author

cranzy commented Dec 6, 2021

@cherrymui
Okay. I have update on the issue:
I did downgrade my go version to go1.16.11.darwin-amd64 . Now I can build and run the binary without any errors.

@cherrymui
Copy link
Member

@cranzy thanks. Could you make sure the golang.org/x/sys dependency is updated? Could you paste the new output for the failure? Thanks.

If this is reproducible, with Go 1.17, could you try building your binary with environment variable GOEXPERIMENT=noregabi (this needs to be set when you build the binary, not running it).

@OsOmE1
Copy link

OsOmE1 commented Dec 14, 2021

Hi there, I would like to add onto this issue because I am facing a similar problem.

go version go1.17.2 darwin/amd64
MacOS 10.15.7 (19H2)
golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827

func segFaultRecover(successful *bool) {
	if r := recover(); r != nil {
		*successful = true
		logrus.Infof("recovered")
	}
}

func PTraceDenyAttach() (bool, error) {
	debug.SetPanicOnFault(true) // So we can recover from the segfault

	_, _, errno := syscall.Syscall(26 /* ptrace */, 31 /* PT_DENY_ATTACH */, 0, 0)
	if errno != 0 {
		return false, os.NewSyscallError("ptrace", errno)
	}
	successful := false
	defer segFaultRecover(&successful)

	err := unix.PtraceAttach(unix.Getpid())
	if err != nil {
		return false, err
	}
	return !successful, nil
}

Expected behavior:
We block the ptrace request, then when we try to attach to our own process a segfault will occur. Then this should be recovered, and we can see if the blocking of ptrace was successful.

What actually happened:

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb01dfacedebac1e pc=0x7fff73a0f59b]

runtime stack:
runtime.throw({0x131ad44, 0x2a})
        /usr/local/opt/go/libexec/src/runtime/panic.go:1198 +0x74
runtime.sigpanic()
        /usr/local/opt/go/libexec/src/runtime/signal_unix.go:719 +0x4a5
runtime.syscall6()
        /usr/local/opt/go/libexec/src/runtime/sys_darwin_amd64.s:746 +0x2c

goroutine 1 [syscall]:
syscall.syscall6(0x10fc020, 0xa, 0x112af, 0x0, 0x0, 0x0, 0x0)
        /usr/local/opt/go/libexec/src/runtime/sys_darwin.go:44 +0x2e fp=0xc000099898 sp=0xc000099870 pc=0x10693ae
golang.org/x/sys/unix.ptrace1(0xa, 0x112af, 0x0, 0x0)
        .../vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go:2443 +0x65 fp=0xc0000998f8 sp=0xc000099898 pc=0x10fbe85
golang.org/x/sys/unix.ptrace(...)
       .../vendor/golang.org/x/sys/unix/ptrace_darwin.go:11
golang.org/x/sys/unix.PtraceAttach(...)
        .../vendor/golang.org/x/sys/unix/syscall_darwin.go:141
.../....PTraceDenyAttach()

@cherrymui
Copy link
Member

@OsOmE1 I'm not sure what you're trying to do. Do you intentionally make it segfault at the ptrace call? It cannot be recovered as we switch to a different stack when issuing the actual syscall.

@OsOmE1
Copy link

OsOmE1 commented Dec 14, 2021

Yes I do, this is an anti debugging technique and to make sure our pt_deny was successful we try to pt_attach and if it was successful it will segfault. If the ptrace call was tampered with, it will not. But thank you for pointing me in the right direction. Any other pointers on how I could make this work are always appreciated

@rbg
Copy link

rbg commented Jan 15, 2022

@cranzy thanks. Could you make sure the golang.org/x/sys dependency is updated? Could you paste the new output for the failure? Thanks.

If this is reproducible, with Go 1.17, could you try building your binary with environment variable GOEXPERIMENT=noregabi (this needs to be set when you build the binary, not running it).

this worked for me seeing a similar issue.

@nook24
Copy link

nook24 commented Feb 9, 2022

What version of golang.org/x/sys do you use? Could you try updating your golang.org/x/sys dependency? Thanks.

Maybe a dup of #45702

Thanks! go get -u golang.org/x/sys resolved the issue for me on macOS Cataline 10.15.7, go1.17.6 darwin/amd64

@seankhliao
Copy link
Member

No new info

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jun 12, 2022
@cranzy
Copy link
Author

cranzy commented Jul 7, 2022

go get -u golang.org/x/sys

Works on 1.18.3 as well on Big Sur 11.6.5 darwin/amd64

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

8 participants