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

runtime: fatal error: Go pointer stored into non-Go memory #23435

Closed
sternix opened this issue Jan 12, 2018 · 2 comments
Closed

runtime: fatal error: Go pointer stored into non-Go memory #23435

sternix opened this issue Jan 12, 2018 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@sternix
Copy link

sternix commented Jan 12, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.10beta2 freebsd/amd64

Does this issue reproduce with the latest release?

i set GODEBUG env variable to
GODEBUG=cgocheck=2
it works with 1.9.2 without error
but 1.10beta2 gives the error below
if i unset GODEBUG variable it works without error

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

$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/sternix/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GOOS="freebsd"
GOPATH="/home/sternix/go"
GORACE=""
GOROOT="/opt/go/1_10b2/go"
GOTMPDIR=""
GOTOOLDIR="/opt/go/1_10b2/go/pkg/tool/freebsd_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build169993598=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ go get -u golang.org/x/crypto/bcrypt

What did you expect to see?

Install without errors

What did you see instead?

$ go get -u -v golang.org/x/crypto/bcrypt 
Fetching https://golang.org/x/crypto/bcrypt?go-get=1
write of Go pointer 0xafb1e0 to non-Go memory 0x800ba3028
fatal error: Go pointer stored into non-Go memory

runtime stack:
runtime.throw(0x8aa71a, 0x24)
        /usr/local/go/src/runtime/panic.go:616 +0x81
runtime.cgoCheckWriteBarrier.func1()
        /usr/local/go/src/runtime/cgocheck.go:48 +0xa9
runtime.systemstack(0x0)
        /usr/local/go/src/runtime/asm_amd64.s:409 +0x79
runtime.mstart()
        /usr/local/go/src/runtime/proc.go:1170

goroutine 22 [running]:
runtime.systemstack_switch()
        /usr/local/go/src/runtime/asm_amd64.s:363 fp=0xc42004d9f0 sp=0xc42004d9e8 pc=0x452980
runtime.cgoCheckWriteBarrier(0x800ba3028, 0xafb1e0)
        /usr/local/go/src/runtime/cgocheck.go:46 +0xaa fp=0xc42004da28 sp=0xc42004d9f0 pc=0x403e7a
runtime.wbBufFlush(0x800ba3028, 0xafb1e0)
        /usr/local/go/src/runtime/mwbbuf.go:169 +0x6b fp=0xc42004da48 sp=0xc42004da28 pc=0x42657b
runtime.gcWriteBarrier(0xffffffffffffffff, 0x200, 0x7c, 0x7d, 0xc42004db40, 0x426e07, 0x800ba3028, 0x7d, 0xc42004db40, 0x428eb9, ...)
        /usr/local/go/src/runtime/asm_amd64.s:2442 +0xb4 fp=0xc42004dad0 sp=0xc42004da48 pc=0x4555b4
runtime.(*timer).assignBucket(...)
        /usr/local/go/src/runtime/time.go:58
runtime.addtimer(0x800ba3028)
        /usr/local/go/src/runtime/time.go:128 +0xac fp=0xc42004db00 sp=0xc42004dad0 pc=0x4471ac
internal/poll.runtime_pollSetDeadline(0x800ba2ff8, 0x23c25f833ce, 0xe9)
        /usr/local/go/src/runtime/netpoll.go:228 +0x127 fp=0xc42004db50 sp=0xc42004db00 pc=0x426e07
internal/poll.setDeadlineImpl(0xc4201a8500, 0xbe8e6a87f4c93962, 0x12a843b2e, 0xaf6e00, 0xe9, 0x0, 0x0)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:154 +0x192 fp=0xc42004dbb0 sp=0xc42004db50 pc=0x48b5a2
internal/poll.(*FD).SetDeadline(0xc4201a8500, 0xbe8e6a87f4c93962, 0x12a843b2e, 0xaf6e00, 0x1, 0x1)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:123 +0x52 fp=0xc42004dbf8 sp=0xc42004dbb0 pc=0x48b2e2
net.(*conn).SetDeadline(0xc420196110, 0xbe8e6a87f4c93962, 0x12a843b2e, 0xaf6e00, 0x0, 0x0)
        /usr/local/go/src/net/net.go:232 +0x6c fp=0xc42004dc48 sp=0xc42004dbf8 pc=0x69e93c
net.(*dnsPacketConn).SetDeadline(0xc4201907c0, 0xbe8e6a87f4c93962, 0x12a843b2e, 0xaf6e00, 0x1, 0xc420198520)
        <autogenerated>:1 +0x5a fp=0xc42004dc88 sp=0xc42004dc48 pc=0x6b506a
net.(*Resolver).exchange(0xaf59e0, 0x905920, 0xc4201cc360, 0xc420198520, 0xa, 0xc420198670, 0xb, 0x8c001c, 0x12a05f200, 0x0, ...)
        /usr/local/go/src/net/dnsclient_unix.go:135 +0x5a8 fp=0xc42004de20 sp=0xc42004dc88 pc=0x685c98
net.(*Resolver).tryOneName(0xaf59e0, 0x905920, 0xc4201cc360, 0xc4201d2320, 0xc420198670, 0xb, 0x1c, 0x0, 0x0, 0x0, ...)
        /usr/local/go/src/net/dnsclient_unix.go:161 +0x148 fp=0xc42004def0 sp=0xc42004de20 pc=0x685f38
net.(*Resolver).goLookupIPCNAMEOrder.func1(0xaf59e0, 0x905920, 0xc4201cc360, 0xc4201d2320, 0xc420190770, 0xc4201cc4e0, 0xc42004001c)
        /usr/local/go/src/net/dnsclient_unix.go:485 +0xb0 fp=0xc42004dfa8 sp=0xc42004def0 pc=0x6b0400
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc42004dfb0 sp=0xc42004dfa8 pc=0x4554f1
created by net.(*Resolver).goLookupIPCNAMEOrder
        /usr/local/go/src/net/dnsclient_unix.go:483 +0x242

goroutine 1 [select]:
net/http.(*Transport).getConn(0xaef400, 0xc420193b00, 0x0, 0xc4201ac270, 0x5, 0xc420198420, 0xe, 0x0, 0x0, 0xc4201d0280)
        /usr/local/go/src/net/http/transport.go:962 +0x54c
net/http.(*Transport).RoundTrip(0xaef400, 0xc4201ae200, 0xaef400, 0x0, 0x0)
        /usr/local/go/src/net/http/transport.go:409 +0x60b
net/http.send(0xc4201ae200, 0x900000, 0xaef400, 0x0, 0x0, 0x0, 0x1, 0x0, 0xc4201960e0, 0xc4201ae200)
        /usr/local/go/src/net/http/client.go:252 +0x185
net/http.(*Client).send(0xaf6aa0, 0xc4201ae200, 0x0, 0x0, 0x0, 0xc4201960e0, 0x0, 0x1, 0x20)
        /usr/local/go/src/net/http/client.go:176 +0xfa
net/http.(*Client).Do(0xaf6aa0, 0xc4201ae200, 0xc4201ac270, 0x2b, 0x0)
        /usr/local/go/src/net/http/client.go:615 +0x28d
net/http.(*Client).Get(0xaf6aa0, 0xc4201ac270, 0x2b, 0x1, 0x1, 0x7fffffffe8dd)
        /usr/local/go/src/net/http/client.go:396 +0x9d
cmd/go/internal/web.GetMaybeInsecure.func1(0x89b7c6, 0x5, 0x8, 0x4d4f7b, 0x7fffffffe8dd, 0xa, 0xc42017722e)
        /usr/local/go/src/cmd/go/internal/web/http.go:90 +0x14b
cmd/go/internal/web.GetMaybeInsecure(0x7fffffffe8dd, 0x1a, 0x0, 0x1, 0x1, 0x8, 0x870e60, 0x403e07, 0xc4201960c0)
        /usr/local/go/src/cmd/go/internal/web/http.go:99 +0xa2
cmd/go/internal/get.repoRootForImportDynamic(0x7fffffffe8dd, 0x1a, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/cmd/go/internal/get/vcs.go:766 +0x102
cmd/go/internal/get.repoRootForImportPath(0x7fffffffe8dd, 0x1a, 0x0, 0x0, 0x4dfefa, 0x85c7c0)
        /usr/local/go/src/cmd/go/internal/get/vcs.go:657 +0x3bb
cmd/go/internal/get.downloadPackage(0xc42007c400, 0xc420095980, 0x7fffffffe8dd)
        /usr/local/go/src/cmd/go/internal/get/get.go:413 +0x1363
cmd/go/internal/get.download(0x7fffffffe8dd, 0x1a, 0x0, 0xc420194220, 0x0)
        /usr/local/go/src/cmd/go/internal/get/get.go:260 +0xccc
cmd/go/internal/get.runGet(0xaedc60, 0xc420190390, 0x1, 0x1)
        /usr/local/go/src/cmd/go/internal/get/get.go:134 +0x14d
main.main()
        /usr/local/go/src/cmd/go/main.go:139 +0x796

goroutine 5 [syscall]:
os/signal.signal_recv(0x0)
        /usr/local/go/src/runtime/sigqueue.go:139 +0xa6
os/signal.loop()
        /usr/local/go/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.0
        /usr/local/go/src/os/signal/signal_unix.go:28 +0x41

goroutine 18 [select]:
net.(*Resolver).LookupIPAddr(0xaf59e0, 0x905920, 0xc4201cc360, 0xc420198420, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/lookup.go:206 +0x4ca
net.(*Resolver).internetAddrList(0xaf59e0, 0x905920, 0xc4201cc360, 0x89ae5f, 0x3, 0xc420198420, 0xe, 0x0, 0x0, 0x0, ...)
        /usr/local/go/src/net/ipsock.go:293 +0x5a9
net.(*Resolver).resolveAddrList(0xaf59e0, 0x905920, 0xc4201cc360, 0x89b1fc, 0x4, 0x89ae5f, 0x3, 0xc420198420, 0xe, 0x0, ...)
        /usr/local/go/src/net/dial.go:193 +0x50c
net.(*Dialer).DialContext(0xc4200724e0, 0x9058e0, 0xc420026110, 0x89ae5f, 0x3, 0xc420198420, 0xe, 0x0, 0x0, 0x0, ...)
        /usr/local/go/src/net/dial.go:375 +0x222
net.(*Dialer).DialContext-fm(0x9058e0, 0xc420026110, 0x89ae5f, 0x3, 0xc420198420, 0xe, 0xc4201e0520, 0x710339, 0xc420026110, 0x824b40)
        /usr/local/go/src/net/http/transport.go:46 +0x73
net/http.(*Transport).dial(0xaef400, 0x9058e0, 0xc420026110, 0x89ae5f, 0x3, 0xc420198420, 0xe, 0x0, 0x0, 0x0, ...)
        /usr/local/go/src/net/http/transport.go:898 +0x20d
net/http.(*Transport).dialConn(0xaef400, 0x9058e0, 0xc420026110, 0x0, 0xc4201ac270, 0x5, 0xc420198420, 0xe, 0x0, 0x0, ...)
        /usr/local/go/src/net/http/transport.go:1143 +0x317
net/http.(*Transport).getConn.func4(0xaef400, 0x9058e0, 0xc420026110, 0xc420193b30, 0xc4201f6000)
        /usr/local/go/src/net/http/transport.go:957 +0x78
created by net/http.(*Transport).getConn
        /usr/local/go/src/net/http/transport.go:956 +0x357

goroutine 20 [chan receive]:
net.(*Resolver).goLookupIPCNAMEOrder(0xaf59e0, 0x905920, 0xc4201cc360, 0xc420198420, 0xa, 0x1, 0xc42007e780, 0xc42007e7a8, 0xc42003adf0, 0xc42003add0, ...)
        /usr/local/go/src/net/dnsclient_unix.go:491 +0x387
net.(*Resolver).lookupIP(0xaf59e0, 0x905920, 0xc4201cc360, 0xc420198420, 0xa, 0xc42007e7a8, 0xc42003ae58, 0x20, 0xc42002e6d0, 0x3)
        /usr/local/go/src/net/lookup_unix.go:101 +0xaa
net.(*Resolver).(net.lookupIP)-fm(0x905920, 0xc4201cc360, 0xc420198420, 0xa, 0x428eb9, 0x8, 0xc42006e240, 0x0, 0xc42003aea0)
        /usr/local/go/src/net/lookup.go:192 +0x56
net.glob..func10(0x905920, 0xc4201cc360, 0xc4201904d0, 0xc420198420, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/hook.go:19 +0x52
net.(*Resolver).LookupIPAddr.func1(0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/lookup.go:200 +0xd8
internal/singleflight.(*Group).doCall(0xaf59d0, 0xc42019a640, 0xc420198420, 0xa, 0xc420193c50)
        /usr/local/go/src/internal/singleflight/singleflight.go:95 +0x2e
created by internal/singleflight.(*Group).DoChan
        /usr/local/go/src/internal/singleflight/singleflight.go:88 +0x2d0

goroutine 21 [runnable]:
sync.(*Mutex).Unlock(0xb14bd0)
        /usr/local/go/src/sync/mutex.go:175 +0xd5
sync.(*Once).Do(0xb14bd0, 0xc4200516a0)
        /usr/local/go/src/sync/once.go:46 +0x77
net.supportsIPv4map(0x0)
        /usr/local/go/src/net/ipsock.go:46 +0x4f
net.setDefaultSockopts(0x4, 0x2, 0x2, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/sockopt_bsd.go:28 +0x26
net.socket(0x905920, 0xc420072960, 0x89ae65, 0x3, 0x2, 0x2, 0x0, 0x0, 0x906e80, 0x0, ...)
        /usr/local/go/src/net/sock_posix.go:46 +0xa6
net.internetSocket(0x905920, 0xc420072960, 0x89ae65, 0x3, 0x906e80, 0x0, 0x906e80, 0xc42016ec00, 0x2, 0x0, ...)
        /usr/local/go/src/net/ipsock_posix.go:141 +0x129
net.dialUDP(0x905920, 0xc420072960, 0x89ae65, 0x3, 0x0, 0xc42016ec00, 0x12a8459bc, 0xaf6e00, 0x12a04ee44)
        /usr/local/go/src/net/udpsock_posix.go:98 +0xb9
net.dialSingle(0x905920, 0xc420072960, 0xc4200b4680, 0x902ba0, 0xc42016ec00, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/dial.go:550 +0x615
net.dialSerial(0x905920, 0xc420072960, 0xc4200b4680, 0xc4200553e0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/net/dial.go:515 +0x22d
net.(*Dialer).DialContext(0xc420051c20, 0x905920, 0xc420072960, 0x89ae65, 0x3, 0xc420198520, 0xa, 0x0, 0x0, 0x0, ...)
        /usr/local/go/src/net/dial.go:397 +0x66f
net.(*Resolver).dial(0xaf59e0, 0x905920, 0xc420072960, 0x89ae65, 0x3, 0xc420198520, 0xa, 0xc4200553d0, 0x0, 0x0, ...)
        /usr/local/go/src/net/lookup_unix.go:66 +0x347
net.(*Resolver).exchange(0xaf59e0, 0x905920, 0xc4201cc360, 0xc420198520, 0xa, 0xc420198670, 0xb, 0x8c0001, 0x12a05f200, 0x0, ...)
        /usr/local/go/src/net/dnsclient_unix.go:129 +0x29e
net.(*Resolver).tryOneName(0xaf59e0, 0x905920, 0xc4201cc360, 0xc4201d2320, 0xc420198670, 0xb, 0x1, 0x0, 0x0, 0xc42003afa8, ...)
        /usr/local/go/src/net/dnsclient_unix.go:161 +0x148
net.(*Resolver).goLookupIPCNAMEOrder.func1(0xaf59e0, 0x905920, 0xc4201cc360, 0xc4201d2320, 0xc420190770, 0xc4201cc4e0, 0xc420040001)
        /usr/local/go/src/net/dnsclient_unix.go:485 +0xb0
created by net.(*Resolver).goLookupIPCNAMEOrder
        /usr/local/go/src/net/dnsclient_unix.go:483 +0x242
@bradfitz
Copy link
Contributor

/cc @aclements @ianlancetaylor

@bradfitz bradfitz added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker labels Jan 12, 2018
@bradfitz bradfitz added this to the Go1.10 milestone Jan 12, 2018
@ianlancetaylor ianlancetaylor changed the title fatal error: Go pointer stored into non-Go memory runtime: fatal error: Go pointer stored into non-Go memory Jan 12, 2018
@ianlancetaylor ianlancetaylor self-assigned this Jan 13, 2018
@gopherbot
Copy link

Change https://golang.org/cl/87637 mentions this issue: runtime: don't issue cgocheck error for timer bucket source pointer

@golang golang locked and limited conversation to collaborators Jan 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants