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

crypto/x509: 0xb01dfacedebac1e crash on Mac OS X 10.8 #16473

Closed
bradfitz opened this issue Jul 22, 2016 · 16 comments
Closed

crypto/x509: 0xb01dfacedebac1e crash on Mac OS X 10.8 #16473

bradfitz opened this issue Jul 22, 2016 · 16 comments
Milestone

Comments

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jul 22, 2016

The Go download page says we support as low as Mac OS X 10.8 (Mountain Lion), so I worked on resurrecting a 10.8 builder and found it fails to run tests:

##### Building Go bootstrap tool.
cmd/dist

##### Building Go toolchain using /usr/local/go.
bootstrap/internal/sys
bootstrap/asm/internal/flags
bootstrap/internal/obj
bootstrap/internal/bio
bootstrap/compile/internal/big
bootstrap/internal/obj/arm
bootstrap/internal/obj/arm64
bootstrap/internal/obj/mips
bootstrap/internal/obj/ppc64
bootstrap/internal/obj/s390x
bootstrap/internal/obj/x86
bootstrap/asm/internal/lex
bootstrap/asm/internal/arch
bootstrap/compile/internal/ssa
bootstrap/asm/internal/asm
bootstrap/asm
bootstrap/internal/gcprog
bootstrap/link/internal/ld
bootstrap/link/internal/amd64
bootstrap/link/internal/arm
bootstrap/compile/internal/gc
bootstrap/link/internal/arm64
bootstrap/link/internal/mips64
bootstrap/link/internal/ppc64
bootstrap/link/internal/s390x
bootstrap/link/internal/x86
bootstrap/link
bootstrap/compile/internal/amd64
bootstrap/compile/internal/arm
bootstrap/compile/internal/arm64
bootstrap/compile/internal/mips64
bootstrap/compile/internal/ppc64
bootstrap/compile/internal/s390x
bootstrap/compile/internal/x86
bootstrap/compile

##### Building go_bootstrap for host, darwin/amd64.
runtime/internal/sys
runtime/internal/atomic
runtime
encoding
internal/race
internal/syscall/windows/sysdll
math
unicode/utf8
errors
sort
sync/atomic
unicode
unicode/utf16
sync
container/heap
syscall
io
internal/singleflight
hash
hash/adler32
strconv
bytes
strings
bufio
path
regexp/syntax
crypto
reflect
encoding/base64
crypto/sha1
internal/syscall/windows/registry
time
internal/syscall/windows
regexp
os
path/filepath
os/signal
io/ioutil
fmt
encoding/binary
net/url
log
context
compress/flate
go/token
encoding/json
debug/dwarf
flag
text/template/parse
os/exec
go/scanner
go/ast
compress/zlib
debug/elf
debug/macho
text/template
go/parser
go/doc
go/build
cmd/go

##### Building packages and commands for darwin/amd64.
runtime/internal/sys
runtime/internal/atomic
runtime
errors
internal/race
sync/atomic
unicode
sync
io
unicode/utf8
math
bytes
bufio
syscall
strconv
time
reflect
os
sort
strings
path/filepath
path
hash
hash/adler32
regexp/syntax
encoding/binary
cmd/internal/sys
fmt
regexp
flag
log
debug/dwarf
cmd/internal/obj
compress/flate
cmd/internal/goobj
debug/gosym
compress/zlib
debug/macho
debug/elf
debug/pe
debug/plan9obj
cmd/vendor/golang.org/x/arch/arm/armasm
cmd/vendor/golang.org/x/arch/x86/x86asm
text/tabwriter
io/ioutil
archive/tar
cmd/internal/objfile
hash/crc32
archive/zip
cmd/addr2line
compress/bzip2
compress/gzip
compress/lzw
container/heap
container/list
container/ring
context
crypto
crypto/subtle
crypto/cipher
math/rand
math/big
crypto/aes
crypto/des
crypto/sha512
crypto/hmac
crypto/md5
crypto/rc4
crypto/sha1
crypto/sha256
crypto/dsa
crypto/elliptic
encoding/asn1
crypto/rand
crypto/ecdsa
crypto/x509/pkix
crypto/rsa
encoding/hex
encoding/base64
vendor/golang_org/x/net/route
encoding/pem
internal/nettrace
internal/singleflight
go/token
os/exec
go/scanner
go/ast
database/sql/driver
database/sql
encoding
encoding/ascii85
go/parser
go/printer
encoding/base32
cmd/cgo
encoding/csv
encoding/gob
unicode/utf16
encoding/json
encoding/xml
runtime/cgo
vendor/golang_org/x/net/http2/hpack
net
vendor/golang_org/x/net/lex/httplex
mime
mime/quotedprintable
net/http/internal
net/url
text/template/parse
text/template
go/doc
go/build
crypto/x509
net/textproto
mime/multipart
net/http/httptrace
go/constant
go/format
go/types
crypto/tls
net/http
text/scanner
go/internal/gccgoimporter
go/internal/gcimporter
go/importer
hash/crc64
hash/fnv
html
html/template
image/color
image
expvar
image/color/palette
image/internal/imageutil
image/draw
image/jpeg
image/gif
image/png
index/suffixarray
internal/syscall/windows/sysdll
runtime/debug
runtime/pprof
runtime/trace
internal/trace
testing
log/syslog
internal/testenv
math/cmplx
net/http/cgi
net/http/cookiejar
net/http/httptest
net/http/fcgi
net/http/httputil
net/http/pprof
net/internal/socktest
net/mail
net/rpc
net/smtp
os/signal
os/user
net/rpc/jsonrpc
runtime/race
testing/iotest
testing/quick
cmd/api
cmd/internal/obj/arm
cmd/internal/obj/arm64
cmd/internal/obj/mips
cmd/internal/obj/ppc64
cmd/internal/obj/s390x
cmd/internal/obj/x86
cmd/asm/internal/flags
cmd/asm/internal/lex
cmd/asm/internal/arch
cmd/internal/bio
cmd/compile/internal/big
cmd/asm/internal/asm
cmd/asm
cmd/compile/internal/ssa
cmd/internal/gcprog
cmd/compile/internal/test
cmd/cover
cmd/dist
cmd/doc
cmd/fix
cmd/go
cmd/compile/internal/gc
cmd/gofmt
cmd/internal/pprof/profile
cmd/internal/pprof/plugin
cmd/internal/pprof/report
cmd/internal/pprof/svg
cmd/internal/pprof/tempfile
cmd/internal/pprof/commands
cmd/internal/pprof/driver
cmd/internal/pprof/fetch
cmd/internal/pprof/symbolizer
cmd/internal/pprof/symbolz
cmd/link/internal/ld
cmd/link/internal/amd64
cmd/link/internal/arm
cmd/link/internal/arm64
cmd/link/internal/mips64
cmd/link/internal/ppc64
cmd/link/internal/s390x
cmd/link/internal/x86
cmd/link
cmd/nm
cmd/objdump
cmd/compile/internal/amd64
cmd/compile/internal/arm
cmd/compile/internal/arm64
cmd/compile/internal/mips64
cmd/compile/internal/ppc64
cmd/compile/internal/s390x
cmd/compile/internal/x86
cmd/pack
cmd/compile
cmd/pprof
cmd/trace
cmd/vet/internal/cfg
cmd/vet/internal/whitelist
cmd/vet
cmd/yacc


##### Testing packages.
ok      archive/tar 0.031s
ok      archive/zip 0.054s
ok      bufio   0.062s
ok      bytes   0.088s
ok      compress/bzip2  0.063s
ok      compress/flate  0.598s
ok      compress/gzip   0.028s
ok      compress/lzw    0.020s
ok      compress/zlib   0.038s
ok      container/heap  0.020s
ok      container/list  0.020s
ok      container/ring  0.030s
ok      context 0.962s
ok      crypto/aes  0.045s
ok      crypto/cipher   0.020s
ok      crypto/des  0.024s
ok      crypto/dsa  0.026s
ok      crypto/ecdsa    0.080s
ok      crypto/elliptic 0.044s
ok      crypto/hmac 0.019s
ok      crypto/md5  0.020s
ok      crypto/rand 0.034s
ok      crypto/rc4  0.091s
ok      crypto/rsa  0.075s
ok      crypto/sha1 0.044s
ok      crypto/sha256   0.022s
ok      crypto/sha512   0.024s
ok      crypto/subtle   0.022s
ok      crypto/tls  0.579s
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb01dfacedebac1e pc=0x7fff910e239f]

runtime stack:
runtime.throw(0x1ce3ea, 0x2a)
    /Users/gopher/go/src/runtime/panic.go:566 +0x95
runtime.sigpanic()
    /Users/gopher/go/src/runtime/sigpanic_unix.go:12 +0x2cc

goroutine 4 [syscall, locked to thread]:
runtime.cgocall(0x16cdd0, 0xc420032c50, 0xc400000000)
    /Users/gopher/go/src/runtime/cgocall.go:131 +0x110 fp=0xc420032c20 sp=0xc420032be0
crypto/x509._Cfunc_FetchPEMRoots(0xc420070018, 0xc400000000)
    crypto/x509/_test/_obj_test/_cgo_gotypes.go:104 +0x49 fp=0xc420032c50 sp=0xc420032c20
crypto/x509.loadSystemRoots(0x0, 0x0, 0x0)
    /Users/gopher/go/src/crypto/x509/root_cgo_darwin.go:101 +0x1ff fp=0xc420032cd8 sp=0xc420032c50
crypto/x509.initSystemRoots()
    /Users/gopher/go/src/crypto/x509/root.go:21 +0x26 fp=0xc420032d10 sp=0xc420032cd8
sync.(*Once).Do(0x2c8ab0, 0x1efe80)
    /Users/gopher/go/src/sync/once.go:44 +0xdb fp=0xc420032d48 sp=0xc420032d10
crypto/x509.systemRootsPool(0x0)
    /Users/gopher/go/src/crypto/x509/root.go:16 +0x39 fp=0xc420032d68 sp=0xc420032d48
crypto/x509.TestSystemRoots(0xc4201b2000)
    /Users/gopher/go/src/crypto/x509/root_darwin_test.go:18 +0x62 fp=0xc420032f78 sp=0xc420032d68
testing.tRunner(0xc4201b2000, 0x1efe28)
    /Users/gopher/go/src/testing/testing.go:610 +0x81 fp=0xc420032fa0 sp=0xc420032f78
runtime.goexit()
    /Users/gopher/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc420032fa8 sp=0xc420032fa0
created by testing.(*T).Run
    /Users/gopher/go/src/testing/testing.go:646 +0x2ec

goroutine 1 [chan receive]:
testing.(*T).Run(0xc4200860c0, 0x1c73bf, 0xf, 0x1efe28, 0x5bd01)
    /Users/gopher/go/src/testing/testing.go:647 +0x316
testing.RunTests.func1(0xc4200860c0)
    /Users/gopher/go/src/testing/testing.go:793 +0x6d
testing.tRunner(0xc4200860c0, 0xc420037e30)
    /Users/gopher/go/src/testing/testing.go:610 +0x81
testing.RunTests(0x1efeb8, 0x2aae80, 0x23, 0x23, 0xf0db)
    /Users/gopher/go/src/testing/testing.go:799 +0x2f0
testing.(*M).Run(0xc420037ef8, 0x0)
    /Users/gopher/go/src/testing/testing.go:743 +0x85
main.main()
    crypto/x509/_test/_testmain.go:124 +0xc2

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /Users/gopher/go/src/runtime/asm_amd64.s:2086 +0x1
FAIL    crypto/x509 0.076s
ok      database/sql    0.053s
ok      database/sql/driver 0.020s
ok      debug/dwarf 0.024s
ok      debug/elf   0.031s
ok      debug/gosym 0.267s
ok      debug/macho 0.021s
ok      debug/pe    0.023s
ok      debug/plan9obj  0.019s
ok      encoding/ascii85    0.020s
ok      encoding/asn1   0.020s
ok      encoding/base32 0.020s
ok      encoding/base64 0.022s
ok      encoding/binary 0.020s
ok      encoding/csv    0.020s
ok      encoding/gob    0.043s
ok      encoding/hex    0.020s
ok      encoding/json   0.166s
ok      encoding/pem    0.027s
ok      encoding/xml    0.027s
ok      errors  0.019s
ok      expvar  0.022s
ok      flag    0.021s
ok      fmt 0.102s
ok      go/ast  0.021s
ok      go/build    0.143s
ok      go/constant 0.021s
ok      go/doc  0.054s
ok      go/format   0.023s
ok      go/internal/gccgoimporter   0.022s
ok      go/internal/gcimporter  0.604s
ok      go/parser   0.068s
ok      go/printer  0.267s
ok      go/scanner  0.022s
ok      go/token    0.032s
ok      go/types    0.423s
ok      hash/adler32    0.023s
ok      hash/crc32  0.019s
ok      hash/crc64  0.019s
ok      hash/fnv    0.020s
ok      html    0.020s
ok      html/template   0.047s
ok      image   0.100s
ok      image/color 0.074s
ok      image/draw  0.062s
ok      image/gif   0.078s
ok      image/jpeg  0.159s
ok      image/png   0.050s
ok      index/suffixarray   0.025s
ok      internal/singleflight   0.031s
ok      internal/trace  0.034s
ok      io  0.038s
ok      io/ioutil   0.025s
ok      log 0.021s
ok      log/syslog  2.053s
ok      math    0.021s
ok      math/big    0.255s
ok      math/cmplx  0.019s
ok      math/rand   0.069s
ok      mime    0.023s
ok      mime/multipart  0.254s
ok      mime/quotedprintable    0.116s
ok      net 4.285s
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb01dfacedebac1e pc=0x7fff910e239f]

runtime stack:
runtime.throw(0x46c4b0, 0x2a)
    /Users/gopher/go/src/runtime/panic.go:566 +0x95
runtime.sigpanic()
    /Users/gopher/go/src/runtime/sigpanic_unix.go:12 +0x2cc

goroutine 213 [syscall, locked to thread]:
runtime.cgocall(0x391370, 0xc420129438, 0xc400000000)
    /Users/gopher/go/src/runtime/cgocall.go:131 +0x110 fp=0xc420129408 sp=0xc4201293c8
crypto/x509._Cfunc_FetchPEMRoots(0xc420026280, 0xc400000000)
    crypto/x509/_obj/_cgo_gotypes.go:104 +0x49 fp=0xc420129438 sp=0xc420129408
crypto/x509.loadSystemRoots(0x0, 0x0, 0x0)
    /Users/gopher/go/src/crypto/x509/root_cgo_darwin.go:101 +0x1ff fp=0xc4201294c0 sp=0xc420129438
crypto/x509.initSystemRoots()
    /Users/gopher/go/src/crypto/x509/root.go:21 +0x26 fp=0xc4201294f8 sp=0xc4201294c0
sync.(*Once).Do(0x6711a8, 0x49dae0)
    /Users/gopher/go/src/sync/once.go:44 +0xdb fp=0xc420129530 sp=0xc4201294f8
crypto/x509.systemRootsPool(0x1)
    /Users/gopher/go/src/crypto/x509/root.go:16 +0x39 fp=0xc420129550 sp=0xc420129530
crypto/x509.(*Certificate).Verify(0xc420089680, 0xc4200eb7c8, 0x9, 0xc420114f60, 0x0, 0xecf2446ee, 0x3b1af873, 0x654980, 0x0, 0x0, ...)
    /Users/gopher/go/src/crypto/x509/verify.go:247 +0x65e fp=0xc4201297a0 sp=0xc420129550
crypto/tls.(*clientHandshakeState).doFullHandshake(0xc420129e38, 0xc4201bc900, 0x31)
    /Users/gopher/go/src/crypto/tls/handshake_client.go:300 +0x2217 fp=0xc420129c20 sp=0xc4201297a0
crypto/tls.(*Conn).clientHandshake(0xc420061c00, 0x49fab0, 0xc420061d00)
    /Users/gopher/go/src/crypto/tls/handshake_client.go:228 +0xfcd fp=0xc420129ef0 sp=0xc420129c20
crypto/tls.(*Conn).Handshake(0xc420061c00, 0x0, 0x0)
    /Users/gopher/go/src/crypto/tls/conn.go:1232 +0xd3 fp=0xc420129f30 sp=0xc420129ef0
net/http.(*Transport).dialConn.func3(0xc420061c00, 0x0, 0xc420102fc0)
    /Users/gopher/go/src/net/http/transport.go:991 +0x2f fp=0xc420129f78 sp=0xc420129f30
runtime.goexit()
    /Users/gopher/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc420129f80 sp=0xc420129f78
created by net/http.(*Transport).dialConn
    /Users/gopher/go/src/net/http/transport.go:996 +0xb48

goroutine 1 [chan receive]:
testing.(*T).Run(0xc42007a0c0, 0x461cd3, 0x1b, 0x49e4d8, 0x5e901)
    /Users/gopher/go/src/testing/testing.go:647 +0x316
testing.RunTests.func1(0xc42007a0c0)
    /Users/gopher/go/src/testing/testing.go:793 +0x6d
testing.tRunner(0xc42007a0c0, 0xc420034e10)
    /Users/gopher/go/src/testing/testing.go:610 +0x81
testing.RunTests(0x49dcd8, 0x650ce0, 0x184, 0x184, 0x64)
    /Users/gopher/go/src/testing/testing.go:799 +0x2f0
testing.(*M).Run(0xc420034ef8, 0x615b)
    /Users/gopher/go/src/testing/testing.go:743 +0x85
net/http_test.TestMain(0xc420034ef8)
    /Users/gopher/go/src/net/http/main_test.go:19 +0x2b
main.main()
    net/http/_test/_testmain.go:872 +0xc2

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /Users/gopher/go/src/runtime/asm_amd64.s:2086 +0x1

goroutine 203 [select]:
net/http.(*Transport).getConn(0xc4207d7e00, 0xc4200fdfa0, 0x0, 0xc4200eb7c0, 0x5, 0xc4200eb7c8, 0xf, 0x0, 0x0, 0x0)
    /Users/gopher/go/src/net/http/transport.go:848 +0x9c4
net/http.(*Transport).RoundTrip(0xc4207d7e00, 0xc4207d7ef0, 0xc4207d7e00, 0x0, 0x0)
    /Users/gopher/go/src/net/http/transport.go:367 +0x307
net/http.send(0xc4207d7ef0, 0x624820, 0xc4207d7e00, 0x0, 0x0, 0x0, 0x8, 0xc420026260, 0x11bf8)
    /Users/gopher/go/src/net/http/client.go:256 +0x15f
net/http.(*Client).send(0xc42012de98, 0xc4207d7ef0, 0x0, 0x0, 0x0, 0xc420026260, 0x0, 0x1)
    /Users/gopher/go/src/net/http/client.go:146 +0x102
net/http.(*Client).doFollowingRedirects(0xc42012de98, 0xc4207d7ef0, 0x49e298, 0x17, 0x0, 0x0)
    /Users/gopher/go/src/net/http/client.go:528 +0x5dd
net/http.(*Client).Get(0xc42012de98, 0xc4200eb7c0, 0x17, 0xc420107a70, 0x0, 0x0)
    /Users/gopher/go/src/net/http/client.go:418 +0x93
net/http_test.TestClientInsecureTransport(0xc42007a900)
    /Users/gopher/go/src/net/http/client_test.go:687 +0x302
testing.tRunner(0xc42007a900, 0x49e4d8)
    /Users/gopher/go/src/testing/testing.go:610 +0x81
created by testing.(*T).Run
    /Users/gopher/go/src/testing/testing.go:646 +0x2ec

goroutine 214 [IO wait]:
net.runtime_pollWait(0x7adaa8, 0x72, 0x7)
    /Users/gopher/go/src/runtime/netpoll.go:160 +0x59
net.(*pollDesc).wait(0xc4207cd8e0, 0x72, 0xc42004d4e8, 0xc4200120d8)
    /Users/gopher/go/src/net/fd_poll_runtime.go:73 +0x38
net.(*pollDesc).waitRead(0xc4207cd8e0, 0x626f60, 0xc4200120d8)
    /Users/gopher/go/src/net/fd_poll_runtime.go:78 +0x34
net.(*netFD).Read(0xc4207cd880, 0xc42010b400, 0x400, 0x400, 0x0, 0x626f60, 0xc4200120d8)
    /Users/gopher/go/src/net/fd_unix.go:220 +0x1a1
net.(*conn).Read(0xc420026270, 0xc42010b400, 0x400, 0x400, 0x0, 0x0, 0x0)
    /Users/gopher/go/src/net/net.go:173 +0x70
crypto/tls.(*block).readFromUntil(0xc420114870, 0x7adbe0, 0xc420026270, 0x5, 0xc420026270, 0x3543f5)
    /Users/gopher/go/src/crypto/tls/conn.go:472 +0x91
crypto/tls.(*Conn).readRecord(0xc4201c4000, 0x416, 0x9, 0xc4207cd8e0)
    /Users/gopher/go/src/crypto/tls/conn.go:574 +0xc4
crypto/tls.(*Conn).readHandshake(0xc4201c4000, 0x337, 0x0, 0x0, 0x4)
    /Users/gopher/go/src/crypto/tls/conn.go:925 +0x8f
crypto/tls.(*serverHandshakeState).doFullHandshake(0xc42004dc08, 0xc420039c00, 0x0)
    /Users/gopher/go/src/crypto/tls/handshake_server.go:447 +0x5a2
crypto/tls.(*Conn).serverHandshake(0xc4201c4000, 0x49fab0, 0xc4201c4100)
    /Users/gopher/go/src/crypto/tls/handshake_server.go:86 +0x309
crypto/tls.(*Conn).Handshake(0xc4201c4000, 0x0, 0x0)
    /Users/gopher/go/src/crypto/tls/conn.go:1234 +0x14e
net/http.(*conn).serve(0xc4202ec000, 0x62a520, 0xc420131500)
    /Users/gopher/go/src/net/http/server.go:1507 +0x121
created by net/http.(*Server).Serve
    /Users/gopher/go/src/net/http/server.go:2295 +0x447

goroutine 204 [IO wait]:
net.runtime_pollWait(0x7ad928, 0x72, 0x0)
    /Users/gopher/go/src/runtime/netpoll.go:160 +0x59
net.(*pollDesc).wait(0xc4207cc610, 0x72, 0xc4200dc588, 0xc4200120d8)
    /Users/gopher/go/src/net/fd_poll_runtime.go:73 +0x38
net.(*pollDesc).waitRead(0xc4207cc610, 0x626f60, 0xc4200120d8)
    /Users/gopher/go/src/net/fd_poll_runtime.go:78 +0x34
net.(*netFD).accept(0xc4207cc5b0, 0x0, 0x6251a0, 0xc4201c2100)
    /Users/gopher/go/src/net/fd_unix.go:396 +0x238
net.(*TCPListener).accept(0xc420026218, 0xc420029800, 0x0, 0x738000)
    /Users/gopher/go/src/net/tcpsock_posix.go:132 +0x2e
net.(*TCPListener).Accept(0xc420026218, 0x3522e, 0xc4200dc690, 0xc0517, 0x55830)
    /Users/gopher/go/src/net/tcpsock.go:222 +0x49
crypto/tls.(*listener).Accept(0xc4200eb7a0, 0x49df18, 0xc4202ec000, 0x62a520, 0xc420131500)
    /Users/gopher/go/src/crypto/tls/tls.go:52 +0x37
net/http.(*Server).Serve(0xc42080e980, 0x629860, 0xc4200eb7a0, 0x0, 0x0)
    /Users/gopher/go/src/net/http/server.go:2275 +0x1c8
net/http/httptest.(*Server).goServe.func1(0xc4207be8a0)
    /Users/gopher/go/src/net/http/httptest/server.go:235 +0x6d
created by net/http/httptest.(*Server).goServe
    /Users/gopher/go/src/net/http/httptest/server.go:236 +0x5c

goroutine 211 [chan receive]:
net/http.(*Transport).dialConn(0xc4207d7e00, 0x62a4a0, 0xc420012640, 0x0, 0xc4200eb7c0, 0x5, 0xc4200eb7c8, 0xf, 0x180001, 0x0, ...)
    /Users/gopher/go/src/net/http/transport.go:997 +0xb8a
net/http.(*Transport).getConn.func4(0xc4207d7e00, 0x62a4a0, 0xc420012640, 0xc4201145d0, 0xc420102c60)
    /Users/gopher/go/src/net/http/transport.go:843 +0x78
created by net/http.(*Transport).getConn
    /Users/gopher/go/src/net/http/transport.go:845 +0x3a1
FAIL    net/http    0.431s
ok      net/http/cgi    0.726s
ok      net/http/cookiejar  0.028s
ok      net/http/fcgi   0.023s
ok      net/http/httptest   0.031s
ok      net/http/httptrace  0.023s
ok      net/http/httputil   0.049s
ok      net/http/internal   0.021s
ok      net/internal/socktest   0.020s
ok      net/mail    0.022s
ok      net/rpc 0.031s
ok      net/rpc/jsonrpc 0.026s
ok      net/smtp    0.050s
ok      net/textproto   0.021s
ok      net/url 0.025s
ok      os  0.490s
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb01dfacedebac1e pc=0x7fff910e239f]

runtime stack:
runtime.throw(0x2edeb1, 0x2a)
    /Users/gopher/go/src/runtime/panic.go:566 +0x95
runtime.sigpanic()
    /Users/gopher/go/src/runtime/sigpanic_unix.go:12 +0x2cc

goroutine 26 [syscall, locked to thread]:
runtime.cgocall(0x250800, 0xc420159438, 0xc400000000)
    /Users/gopher/go/src/runtime/cgocall.go:131 +0x110 fp=0xc420159408 sp=0xc4201593c8
crypto/x509._Cfunc_FetchPEMRoots(0xc4200fa398, 0xc400000000)
    crypto/x509/_obj/_cgo_gotypes.go:104 +0x49 fp=0xc420159438 sp=0xc420159408
crypto/x509.loadSystemRoots(0x0, 0x0, 0x0)
    /Users/gopher/go/src/crypto/x509/root_cgo_darwin.go:101 +0x1ff fp=0xc4201594c0 sp=0xc420159438
crypto/x509.initSystemRoots()
    /Users/gopher/go/src/crypto/x509/root.go:21 +0x26 fp=0xc4201594f8 sp=0xc4201594c0
sync.(*Once).Do(0x444020, 0x308338)
    /Users/gopher/go/src/sync/once.go:44 +0xdb fp=0xc420159530 sp=0xc4201594f8
crypto/x509.systemRootsPool(0x1)
    /Users/gopher/go/src/crypto/x509/root.go:16 +0x39 fp=0xc420159550 sp=0xc420159530
crypto/x509.(*Certificate).Verify(0xc420168480, 0xc420165d88, 0x9, 0xc42020a390, 0x0, 0xecf2446f6, 0x38ac0df3, 0x427920, 0x0, 0x0, ...)
    /Users/gopher/go/src/crypto/x509/verify.go:247 +0x65e fp=0xc4201597a0 sp=0xc420159550
crypto/tls.(*clientHandshakeState).doFullHandshake(0xc420159e38, 0xc4200f0680, 0x40)
    /Users/gopher/go/src/crypto/tls/handshake_client.go:300 +0x2217 fp=0xc420159c20 sp=0xc4201597a0
crypto/tls.(*Conn).clientHandshake(0xc420152380, 0x308da0, 0xc420152480)
    /Users/gopher/go/src/crypto/tls/handshake_client.go:228 +0xfcd fp=0xc420159ef0 sp=0xc420159c20
crypto/tls.(*Conn).Handshake(0xc420152380, 0x0, 0x0)
    /Users/gopher/go/src/crypto/tls/conn.go:1232 +0xd3 fp=0xc420159f30 sp=0xc420159ef0
net/http.(*Transport).dialConn.func3(0xc420152380, 0xc4200f0300, 0xc4200f2c00)
    /Users/gopher/go/src/net/http/transport.go:991 +0x2f fp=0xc420159f78 sp=0xc420159f30
runtime.goexit()
    /Users/gopher/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc420159f80 sp=0xc420159f78
created by net/http.(*Transport).dialConn
    /Users/gopher/go/src/net/http/transport.go:996 +0xb48

goroutine 1 [chan receive]:
testing.(*T).Run(0xc42007a0c0, 0x2e42a4, 0xe, 0x308850, 0x5e201)
    /Users/gopher/go/src/testing/testing.go:647 +0x316
testing.RunTests.func1(0xc42007a0c0)
    /Users/gopher/go/src/testing/testing.go:793 +0x6d
testing.tRunner(0xc42007a0c0, 0xc420047e20)
    /Users/gopher/go/src/testing/testing.go:610 +0x81
testing.RunTests(0x308388, 0x424c20, 0x15, 0x15, 0xf78b)
    /Users/gopher/go/src/testing/testing.go:799 +0x2f0
testing.(*M).Run(0xc420047ee8, 0xc420047f28)
    /Users/gopher/go/src/testing/testing.go:743 +0x85
main.main()
    os/exec/_test/_testmain.go:96 +0xc2

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /Users/gopher/go/src/runtime/asm_amd64.s:2086 +0x1

goroutine 24 [chan receive]:
net/http.(*Transport).dialConn(0xc4200be000, 0x40c640, 0xc420012568, 0x0, 0xc420165d80, 0x5, 0xc420165d88, 0xf, 0x0, 0x0, ...)
    /Users/gopher/go/src/net/http/transport.go:997 +0xb8a
net/http.(*Transport).getConn.func4(0xc4200be000, 0x40c640, 0xc420012568, 0xc4200c58f0, 0xc4200f2780)
    /Users/gopher/go/src/net/http/transport.go:843 +0x78
created by net/http.(*Transport).getConn
    /Users/gopher/go/src/net/http/transport.go:845 +0x3a1

goroutine 45 [IO wait]:
net.runtime_pollWait(0x680d88, 0x72, 0x9)
    /Users/gopher/go/src/runtime/netpoll.go:160 +0x59
net.(*pollDesc).wait(0xc420052450, 0x72, 0xc4200454e8, 0xc4200120d8)
    /Users/gopher/go/src/net/fd_poll_runtime.go:73 +0x38
net.(*pollDesc).waitRead(0xc420052450, 0x409b00, 0xc4200120d8)
    /Users/gopher/go/src/net/fd_poll_runtime.go:78 +0x34
net.(*netFD).Read(0xc4200523f0, 0xc420029800, 0x400, 0x400, 0x0, 0x409b00, 0xc4200120d8)
    /Users/gopher/go/src/net/fd_unix.go:220 +0x1a1
net.(*conn).Read(0xc4200262b0, 0xc420029800, 0x400, 0x400, 0x0, 0x0, 0x0)
    /Users/gopher/go/src/net/net.go:173 +0x70
crypto/tls.(*block).readFromUntil(0xc42013e960, 0x644318, 0xc4200262b0, 0x5, 0xc4200262b0, 0x1)
    /Users/gopher/go/src/crypto/tls/conn.go:472 +0x91
crypto/tls.(*Conn).readRecord(0xc420061c00, 0x416, 0x9, 0xc420052450)
    /Users/gopher/go/src/crypto/tls/conn.go:574 +0xc4
crypto/tls.(*Conn).readHandshake(0xc420061c00, 0x346, 0x0, 0x0, 0x4)
    /Users/gopher/go/src/crypto/tls/conn.go:925 +0x8f
crypto/tls.(*serverHandshakeState).doFullHandshake(0xc420045c08, 0xc420038c00, 0x0)
    /Users/gopher/go/src/crypto/tls/handshake_server.go:447 +0x5a2
crypto/tls.(*Conn).serverHandshake(0xc420061c00, 0x308da0, 0xc420061d00)
    /Users/gopher/go/src/crypto/tls/handshake_server.go:86 +0x309
crypto/tls.(*Conn).Handshake(0xc420061c00, 0x0, 0x0)
    /Users/gopher/go/src/crypto/tls/conn.go:1234 +0x14e
net/http.(*conn).serve(0xc420018780, 0x40c6c0, 0xc42013e870)
    /Users/gopher/go/src/net/http/server.go:1507 +0x121
created by net/http.(*Server).Serve
    /Users/gopher/go/src/net/http/server.go:2295 +0x447

goroutine 23 [IO wait]:
net.runtime_pollWait(0x680e48, 0x72, 0x0)
    /Users/gopher/go/src/runtime/netpoll.go:160 +0x59
net.(*pollDesc).wait(0xc4200f8220, 0x72, 0xc420024588, 0xc4200120d8)
    /Users/gopher/go/src/net/fd_poll_runtime.go:73 +0x38
net.(*pollDesc).waitRead(0xc4200f8220, 0x409b00, 0xc4200120d8)
    /Users/gopher/go/src/net/fd_poll_runtime.go:78 +0x34
net.(*netFD).accept(0xc4200f81c0, 0x0, 0x4083c0, 0xc420144180)
    /Users/gopher/go/src/net/fd_unix.go:396 +0x238
net.(*TCPListener).accept(0xc4200fa368, 0xc420028800, 0x0, 0x600000)
    /Users/gopher/go/src/net/tcpsock_posix.go:132 +0x2e
net.(*TCPListener).Accept(0xc4200fa368, 0x34e1e, 0xc420024690, 0x169597, 0x55350)
    /Users/gopher/go/src/net/tcpsock.go:222 +0x49
crypto/tls.(*listener).Accept(0xc420165d60, 0x308560, 0xc420018780, 0x40c6c0, 0xc42013e870)
    /Users/gopher/go/src/crypto/tls/tls.go:52 +0x37
net/http.(*Server).Serve(0xc4200fe080, 0x40be00, 0xc420165d60, 0x0, 0x0)
    /Users/gopher/go/src/net/http/server.go:2275 +0x1c8
net/http/httptest.(*Server).goServe.func1(0xc4200f22a0)
    /Users/gopher/go/src/net/http/httptest/server.go:235 +0x6d
created by net/http/httptest.(*Server).goServe
    /Users/gopher/go/src/net/http/httptest/server.go:236 +0x5c

goroutine 22 [select]:
net/http.(*Transport).getConn(0xc4200be000, 0xc420165e40, 0x0, 0xc420165d80, 0x5, 0xc420165d88, 0xf, 0x0, 0x0, 0x6004b0)
    /Users/gopher/go/src/net/http/transport.go:848 +0x9c4
net/http.(*Transport).RoundTrip(0xc4200be000, 0xc42016a000, 0xc4200be000, 0x0, 0x0)
    /Users/gopher/go/src/net/http/transport.go:367 +0x307
net/http.send(0xc42016a000, 0x407d80, 0xc4200be000, 0x0, 0x0, 0x0, 0x8, 0xc4200fa380, 0x11828)
    /Users/gopher/go/src/net/http/client.go:256 +0x15f
net/http.(*Client).send(0x427680, 0xc42016a000, 0x0, 0x0, 0x0, 0xc4200fa380, 0x0, 0x1)
    /Users/gopher/go/src/net/http/client.go:146 +0x102
net/http.(*Client).doFollowingRedirects(0x427680, 0xc42016a000, 0x3086f8, 0x17, 0x0, 0x0)
    /Users/gopher/go/src/net/http/client.go:528 +0x5dd
net/http.(*Client).Get(0x427680, 0xc420165d80, 0x17, 0x84c26, 0xc42015dd18, 0xc42015dd28)
    /Users/gopher/go/src/net/http/client.go:418 +0x93
net/http.Get(0xc420165d80, 0x17, 0xc4200f22a0, 0x0, 0x0)
    /Users/gopher/go/src/net/http/client.go:393 +0x41
os/exec_test.TestExtraFiles(0xc4200ee240)
    /Users/gopher/go/src/os/exec/exec_test.go:474 +0x33b
testing.tRunner(0xc4200ee240, 0x308850)
    /Users/gopher/go/src/testing/testing.go:610 +0x81
created by testing.(*T).Run
    /Users/gopher/go/src/testing/testing.go:646 +0x2ec
FAIL    os/exec 0.331s
ok      os/signal   4.366s
ok      os/user 0.024s
ok      path    0.019s
ok      path/filepath   0.057s
ok      reflect 0.069s
ok      regexp  0.116s
ok      regexp/syntax   0.304s
ok      runtime 16.577s
ok      runtime/debug   0.024s
ok      runtime/internal/atomic 0.163s
ok      runtime/internal/sys    0.019s
ok      runtime/pprof   9.083s
ok      runtime/trace   1.340s
ok      sort    0.066s
ok      strconv 0.352s
ok      strings 0.097s
ok      sync    0.129s
ok      sync/atomic 0.034s
ok      syscall 0.153s
ok      testing 2.385s
ok      testing/quick   0.049s
ok      text/scanner    0.023s
ok      text/tabwriter  0.020s
ok      text/template   0.290s
ok      text/template/parse 0.024s
ok      time    2.372s
ok      unicode 0.019s
ok      unicode/utf16   0.020s
ok      unicode/utf8    0.026s
ok      vendor/golang_org/x/net/http2/hpack 0.022s
ok      vendor/golang_org/x/net/lex/httplex 0.021s
ok      vendor/golang_org/x/net/route   0.027s
ok      cmd/addr2line   0.721s
ok      cmd/api 0.030s
ok      cmd/asm/internal/asm    0.178s
ok      cmd/asm/internal/lex    0.020s
ok      cmd/compile/internal/big    0.566s
ok      cmd/compile/internal/gc 16.351s
ok      cmd/compile/internal/ssa    0.156s
ok      cmd/compile/internal/test   0.027s
ok      cmd/cover   1.152s
ok      cmd/doc 0.043s
ok      cmd/fix 0.026s
ok      cmd/go  49.373s
ok      cmd/gofmt   0.041s
ok      cmd/internal/goobj  0.019s
ok      cmd/internal/obj    0.024s
ok      cmd/internal/obj/x86    0.020s
ok      cmd/internal/pprof/profile  0.021s
ok      cmd/link    0.020s
ok      cmd/nm  0.718s
ok      cmd/objdump 1.715s
ok      cmd/pack    1.573s
ok      cmd/vendor/golang.org/x/arch/arm/armasm 0.022s
ok      cmd/vendor/golang.org/x/arch/x86/x86asm 0.190s
ok      cmd/vet 2.660s
ok      cmd/vet/internal/cfg    0.024s
2016/07/22 09:56:52 Failed: exit status 1

/cc @ianlancetaylor

@bradfitz bradfitz added this to the Go1.7Maybe milestone Jul 22, 2016
@bradfitz
Copy link
Contributor Author

@bradfitz bradfitz commented Jul 22, 2016

gcc --version says Apple LLVM version 5.1 (clang-503.0.40).

Machine is darwin/amd64. Darwin kernel 12.2.0.

Git rev is 243d51f

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jul 23, 2016

This appears to be a portability problem in the C code that was added in https://golang.org/cl/20351. This pure C program fails with a segmentation violation at the same point (when calling CFEqual).

CC @hinman

I don't know what this code does and I don't plan to look at this further.

#include <stdio.h>
#include <CoreFoundation/CoreFoundation.h>
#include <Security/Security.h>

int FetchPEMRoots(CFDataRef *pemRoots) {
    // Get certificates from all domains, not just System, this lets
    // the user add CAs to their "login" keychain, and Admins to add
    // to the "System" keychain
    SecTrustSettingsDomain domains[] = { kSecTrustSettingsDomainSystem,
                     kSecTrustSettingsDomainAdmin,
                     kSecTrustSettingsDomainUser };

    int numDomains = sizeof(domains)/sizeof(SecTrustSettingsDomain);
    if (pemRoots == NULL) {
        return -1;
    }

    CFMutableDataRef combinedData = CFDataCreateMutable(kCFAllocatorDefault, 0);
    for (int i = 0; i < numDomains; i++) {
        CFArrayRef certs = NULL;
        // Only get certificates from domain that are trusted
        OSStatus err = SecTrustSettingsCopyCertificates(domains[i], &certs);
        if (err != noErr) {
            continue;
        }

        int numCerts = CFArrayGetCount(certs);
        for (int j = 0; j < numCerts; j++) {
            CFDataRef data = NULL;
            CFErrorRef errRef = NULL;
            SecCertificateRef cert = (SecCertificateRef)CFArrayGetValueAtIndex(certs, j);
            if (cert == NULL) {
                continue;
            }
            // We only want to add Root CAs, so make sure Subject and Issuer Name match
            CFDataRef subjectName = SecCertificateCopyNormalizedSubjectContent(cert, &errRef);
            if (errRef != NULL) {
                CFRelease(errRef);
                continue;
            }
            CFDataRef issuerName = SecCertificateCopyNormalizedIssuerContent(cert, &errRef);
            if (errRef != NULL) {
                CFRelease(subjectName);
                CFRelease(errRef);
                continue;
            }
            Boolean equal = CFEqual(subjectName, issuerName);
            CFRelease(subjectName);
            CFRelease(issuerName);
            if (!equal) {
                continue;
            }

            // Note: SecKeychainItemExport is deprecated as of 10.7 in favor of SecItemExport.
            // Once we support weak imports via cgo we should prefer that, and fall back to this
            // for older systems.
            err = SecKeychainItemExport(cert, kSecFormatX509Cert, kSecItemPemArmour, NULL, &data);
            if (err != noErr) {
                continue;
            }

            if (data != NULL) {
                CFDataAppendBytes(combinedData, CFDataGetBytePtr(data), CFDataGetLength(data));
                CFRelease(data);
            }
        }
        CFRelease(certs);
    }
    *pemRoots = combinedData;
    return 0;
}

int main() {
  CFDataRef data = NULL;
  FetchPEMRoots(&data);
  printf("%p\n", data);
}
@ianlancetaylor ianlancetaylor removed their assignment Jul 23, 2016
@bradfitz bradfitz modified the milestones: Go1.7, Go1.7Maybe Jul 23, 2016
@bradfitz
Copy link
Contributor Author

@bradfitz bradfitz commented Jul 23, 2016

Thanks, @ianlancetaylor.

@adg, @broady, for Go 1.7 we need to do one of:

  • update our minimum supported Mac version for Go 1.7,
  • document this regression in the release notes, to be fixed later,
  • fix the new C code,
  • or maybe just skip this new code path when running on old OS X versions

I'll work on testing OS X 10.9 to see if it's also affected, or whether it's just 10.8. (10.10, 10.11, and 10.12 seem fine)

@hinman
Copy link
Contributor

@hinman hinman commented Jul 23, 2016

I'll see if I can get a 10.8 build env and replicate, I think I know what is going on.

@bradfitz
Copy link
Contributor Author

@bradfitz bradfitz commented Jul 23, 2016

@hinman, email me (bradfitz at golang) and I can get you ssh access to a 10.8 VM if that would help.

@adg
Copy link
Contributor

@adg adg commented Jul 24, 2016

I'd like to try and support 10.8 if we can. It's only 4 years old.

@hinman
Copy link
Contributor

@hinman hinman commented Jul 25, 2016

The following fix works for me on 10.8.5 and 10.11.5

https://go-review.googlesource.com/25190

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 25, 2016

CL https://golang.org/cl/25190 mentions this issue.

@bradfitz
Copy link
Contributor Author

@bradfitz bradfitz commented Jul 25, 2016

I'll work on testing OS X 10.9 to see if it's also affected, or whether it's just 10.8. (10.10, 10.11, and 10.12 seem fine)

10.9 looks fine.

@bradfitz
Copy link
Contributor Author

@bradfitz bradfitz commented Jul 26, 2016

@josharian suggested we do something like https://golang.org/cl/25233 instead, using the old implementation for OS X 10.8, rather than changing the implementation this late in the Go 1.7 cycle.

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 26, 2016

CL https://golang.org/cl/25233 mentions this issue.

@gopherbot gopherbot closed this in ff60da6 Jul 26, 2016
@bradfitz
Copy link
Contributor Author

@bradfitz bradfitz commented Jul 26, 2016

Per @josharian's comment, the submitted CL isn't enough. We need runtime detection of OS X version, not compile-time. Patchset 1 of https://golang.org/cl/25233 was better in retrospect, even though there's probably a cheaper way to query it than os/exec to sw_vers. @quentinmit, you know Mac APIs?

Or @nickoneill?

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 26, 2016

CL https://golang.org/cl/25281 mentions this issue.

gopherbot pushed a commit that referenced this issue Jul 26, 2016
https://golang.org/cl/25233 was detecting the OS X release at compile
time, not run time. Detect it at run time instead.

Fixes #16473 (again)

Change-Id: I6bec4996e57aa50c52599c165aa6f1fae7423fa7
Reviewed-on: https://go-review.googlesource.com/25281
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
@andlabs
Copy link
Contributor

@andlabs andlabs commented Jul 26, 2016

Just out of curiosity, what exactly is going on? The only other reference I see to this particular issue is another github project; is this a regression in 10.8? (For what it's worth, I have 10.8-10.10 VMs to test potential issues with as well.)

@hinman
Copy link
Contributor

@hinman hinman commented Jul 27, 2016

@andlabs I didn't look too deeply but I think this is a regression is 10.8. For whatever reason the CFData structure that is returned looks like it hasn't been initialized correctly, but there is no error set. The functions worked fine on 10.11 and 10.10.

@bradfitz bradfitz changed the title build: 0xb01dfacedebac1e crash on Mac OS X 10.8 crypto/x509: 0xb01dfacedebac1e crash on Mac OS X 10.8 Jul 27, 2016
@bradfitz
Copy link
Contributor Author

@bradfitz bradfitz commented Jul 27, 2016

I've opened #16508 to track fixing this more properly in Go 1.8. Thanks again to @hinman for a working fix. It was just too risky for this late in Go 1.7, especially without appropriate reviewers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.