Skip to content

crypto/x509: FetchPEMRoots in CGO crashed with signal SIGSEGV on go get gopkg.in/sourcemap.v1 on macOS Sierra (10.12.6) #24190

@ericreis

Description

@ericreis

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

go version go1.10 darwin/amd64

Does this issue reproduce with the latest release?

yes

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

macOS Sierra (10.12.6)

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ericreis/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ericreis/dev/golang"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10/libexec/pkg/tool/darwin_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=/var/folders/bx/xqyzvybj06scstvsdxpcd7980000gn/T/go-build639091728=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

  1. Just tried to run go get github.com/robertkrimen/otto
  2. After many attempts to fix (reinstalling go, updating from OS X El Capitain to macOS Sierra)
  3. Tried to install the same otto package in my windows desktop and it was successful
  4. Opened an issue in the otto github (Is there a way to install otto via go get? Error when running go get. robertkrimen/otto#291)
  5. Discovered that the problem was actually in the gopkg.in/sourcemap.v1 package (the only dependency of the otto package, according to the collaborator that helped me with this issue)
  6. Tried to run go get gopkg.in/sourcemap.v1 and the same problem occurred
  7. The last thing I tried was running the following code that the otto collaborator asked me to run:
package main

import (
	"fmt"
	"net/http"
)

func main() {
	res, err := http.Get("https://gopkg.in/sourcemap.v1?go-get=1")
	if err != nil {
		panic(err)
	}

	fmt.Printf("%#v\n", res)
}

What did you expect to see?

Expected to not see the same SIGSEGV error.

What did you see instead?

The same SIGSEGV error:

go run main.go 
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb01dfacedebac1e pc=0x143e7f9]

runtime stack:
runtime.throw(0x127a124, 0x2a)
	/usr/local/Cellar/go/1.10/libexec/src/runtime/panic.go:619 +0x81
runtime.sigpanic()
	/usr/local/Cellar/go/1.10/libexec/src/runtime/signal_unix.go:372 +0x28e

goroutine 21 [syscall]:
runtime.cgocall(0x1001840, 0xc4201814a8, 0x12077c0)
	/usr/local/Cellar/go/1.10/libexec/src/runtime/cgocall.go:128 +0x64 fp=0xc420181478 sp=0xc420181440 pc=0x1003194
crypto/x509._Cfunc_FetchPEMRoots(0xc4200a10c0, 0xc4200a10c8, 0xc400000000)
	_cgo_gotypes.go:104 +0x4d fp=0xc4201814a8 sp=0xc420181478 pc=0x1150a1d
crypto/x509.loadSystemRoots.func1(0xc4200a10c0, 0xc4200a10c8, 0xc420113540)
	/usr/local/Cellar/go/1.10/libexec/src/crypto/x509/root_cgo_darwin.go:226 +0x123 fp=0xc4201814e0 sp=0xc4201814a8 pc=0x1153f93
crypto/x509.loadSystemRoots(0x0, 0x0, 0x0)
	/usr/local/Cellar/go/1.10/libexec/src/crypto/x509/root_cgo_darwin.go:226 +0xf6 fp=0xc4201815b8 sp=0xc4201814e0 pc=0x1150be6
crypto/x509.initSystemRoots()
	/usr/local/Cellar/go/1.10/libexec/src/crypto/x509/root.go:21 +0x22 fp=0xc4201815e0 sp=0xc4201815b8 pc=0x1145532
sync.(*Once).Do(0x13e4948, 0x1281b88)
	/usr/local/Cellar/go/1.10/libexec/src/sync/once.go:44 +0xbe fp=0xc420181618 sp=0xc4201815e0 pc=0x106734e
crypto/x509.systemRootsPool(0x6)
	/usr/local/Cellar/go/1.10/libexec/src/crypto/x509/root.go:16 +0x39 fp=0xc420181638 sp=0xc420181618 pc=0x11454e9
crypto/x509.(*Certificate).Verify(0xc4200e8580, 0xc4200a0400, 0x8, 0xc42009b440, 0x0, 0xbe9e0209cd38ac76, 0x18c986bf, 0x13c7100, 0x0, 0x0, ...)
	/usr/local/Cellar/go/1.10/libexec/src/crypto/x509/verify.go:815 +0x734 fp=0xc420181890 sp=0xc420181638 pc=0x1149374
crypto/tls.(*clientHandshakeState).doFullHandshake(0xc420181e70, 0xc42009e0c0, 0x3a)
	/usr/local/Cellar/go/1.10/libexec/src/crypto/tls/handshake_client.go:339 +0x526 fp=0xc420181cd8 sp=0xc420181890 pc=0x116f556
crypto/tls.(*clientHandshakeState).handshake(0xc420181e70, 0xc4200e4280, 0x0)
	/usr/local/Cellar/go/1.10/libexec/src/crypto/tls/handshake_client.go:247 +0x481 fp=0xc420181df0 sp=0xc420181cd8 pc=0x116e9f1
crypto/tls.(*Conn).clientHandshake(0xc4200a6a80, 0x1282380, 0xc4200a6ba0)
	/usr/local/Cellar/go/1.10/libexec/src/crypto/tls/handshake_client.go:168 +0x38c fp=0xc420181f28 sp=0xc420181df0 pc=0x116e31c
crypto/tls.(*Conn).Handshake(0xc4200a6a80, 0x0, 0x0)
	/usr/local/Cellar/go/1.10/libexec/src/crypto/tls/conn.go:1329 +0x185 fp=0xc420181f78 sp=0xc420181f28 pc=0x116d095
net/http.(*persistConn).addTLS.func2(0x0, 0xc4200a6a80, 0xc4200ae280, 0xc4201262a0)
	/usr/local/Cellar/go/1.10/libexec/src/net/http/transport.go:1068 +0x42 fp=0xc420181fc0 sp=0xc420181f78 pc=0x11e1862
runtime.goexit()
	/usr/local/Cellar/go/1.10/libexec/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc420181fc8 sp=0xc420181fc0 pc=0x10557e1
created by net/http.(*persistConn).addTLS
	/usr/local/Cellar/go/1.10/libexec/src/net/http/transport.go:1064 +0x19f

goroutine 1 [select]:
net/http.(*Transport).getConn(0x13c26c0, 0xc42009ade0, 0x0, 0x1278f09, 0x5, 0xc4200a0400, 0xc, 0x0, 0x0, 0x0)
	/usr/local/Cellar/go/1.10/libexec/src/net/http/transport.go:962 +0x558
net/http.(*Transport).RoundTrip(0x13c26c0, 0xc42012c000, 0x13c26c0, 0x0, 0x0)
	/usr/local/Cellar/go/1.10/libexec/src/net/http/transport.go:409 +0x632
net/http.send(0xc42012c000, 0x129e940, 0x13c26c0, 0x0, 0x0, 0x0, 0xc4200ac038, 0xf8, 0xc420067cf8, 0x1)
	/usr/local/Cellar/go/1.10/libexec/src/net/http/client.go:252 +0x185
net/http.(*Client).send(0x13c6e40, 0xc42012c000, 0x0, 0x0, 0x0, 0xc4200ac038, 0x0, 0x1, 0x1011ef8)
	/usr/local/Cellar/go/1.10/libexec/src/net/http/client.go:176 +0xfa
net/http.(*Client).Do(0x13c6e40, 0xc42012c000, 0x1278f09, 0x26, 0x0)
	/usr/local/Cellar/go/1.10/libexec/src/net/http/client.go:615 +0x28d
net/http.(*Client).Get(0x13c6e40, 0x1278f09, 0x26, 0xc42009abd0, 0xc4200b4780, 0xc42009aba0)
	/usr/local/Cellar/go/1.10/libexec/src/net/http/client.go:396 +0x9d
net/http.Get(0x1278f09, 0x26, 0x0, 0xc42009a990, 0xc42009a870)
	/usr/local/Cellar/go/1.10/libexec/src/net/http/client.go:370 +0x41
main.main()
	/Users/ericreis/dev/golang/src/github.com/ericreis/test/main.go:9 +0x3a

goroutine 19 [chan receive]:
net/http.(*persistConn).addTLS(0xc42013c000, 0xc4200a0400, 0x8, 0x0, 0xc4200a0409, 0x3)
	/usr/local/Cellar/go/1.10/libexec/src/net/http/transport.go:1074 +0x1c8
net/http.(*Transport).dialConn(0x13c26c0, 0x12a0fe0, 0xc4200a0020, 0x0, 0x1278f09, 0x5, 0xc4200a0400, 0xc, 0x0, 0x0, ...)
	/usr/local/Cellar/go/1.10/libexec/src/net/http/transport.go:1153 +0x14c3
net/http.(*Transport).getConn.func4(0x13c26c0, 0x12a0fe0, 0xc4200a0020, 0xc42009ae10, 0xc42008c120)
	/usr/local/Cellar/go/1.10/libexec/src/net/http/transport.go:957 +0x78
created by net/http.(*Transport).getConn
	/usr/local/Cellar/go/1.10/libexec/src/net/http/transport.go:956 +0x363
exit status 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Darwin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions