Running a compiled Go binary with a strange path causes crashes that are very similar to #51759, so perhaps the crash is rather in crypto/x509 than in net/http.
I can only reproduce it when calling the Go binary with a path that includes a double slash // and a directory that starts with a dot .. I have no idea why this is or how to further debug is.
This reproducing script sets up a minimal folder structure, build the tool and runs it in a way that causes crashes:
Calling it e.g. with $(pwd)/dir/../.dot/repro, $(pwd)//.dot/repro, or $(pwd)/.dot/repro does not cause the same crash.
Full panic output
go: creating new go.mod: module repro
SIGTRAP: trace trap
PC=0x197eb5458 m=5 sigcode=0
goroutine 0 [idle]:
crypto/x509/internal/macos.syscall(0x14000100000?, 0x140000ba1e0?, 0x1400013b1e8?, 0x1027d7378?, 0x1400013b1b8?, 0x1028dfd20?, 0x102a34420?)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/sys_darwin.go:99 +0x5c fp=0x1400013b150 sp=0x1400013b0b0 pc=0x102803d1c
crypto/x509/internal/macos.CFRelease(0x140000ba1e0?)
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/x509/internal/macos/corefoundation.go:156 +0x40 fp=0x1400013b1a0 sp=0x1400013b150 pc=0x1028df930
crypto/x509/internal/macos.ReleaseCFArray(0x1400013b228?)
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/x509/internal/macos/corefoundation.go:211 +0x30 fp=0x1400013b1d0 sp=0x1400013b1a0 pc=0x1028dfbc0
crypto/x509.(*Certificate).systemVerify.func2()
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/x509/root_darwin.go:34 +0x28 fp=0x1400013b1f0 sp=0x1400013b1d0 pc=0x1028e77a8
runtime.deferreturn()
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/panic.go:476 +0x34 fp=0x1400013b230 sp=0x1400013b1f0 pc=0x1027d7384
crypto/x509.(*Certificate).systemVerify(0x140000d8000, 0x1400013b5f0)
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/x509/root_darwin.go:40 +0x360 fp=0x1400013b490 sp=0x1400013b230 pc=0x1028e72a0
crypto/x509.(*Certificate).Verify(0x140000d8000, {{0x1400012e290, 0xa}, 0x140000927e0, 0x0, {0xc0b906432398fdc8, 0x327a142, 0x102bc0fe0}, {0x0, 0x0, ...}, ...})
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/x509/verify.go:768 +0x474 fp=0x1400013b5e0 sp=0x1400013b490 pc=0x1028eaca4
crypto/tls.(*Conn).verifyServerCertificate(0x14000098000, {0x140000914a0, 0x3, 0x4})
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/tls/handshake_client.go:874 +0x4fc fp=0x1400013b870 sp=0x1400013b5e0 pc=0x1029001ac
crypto/tls.(*clientHandshakeStateTLS13).readServerCertificate(0x1400013bc78)
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/tls/handshake_client_tls13.go:461 +0x274 fp=0x1400013ba80 sp=0x1400013b870 pc=0x102902754
crypto/tls.(*clientHandshakeStateTLS13).handshake(0x1400013bc78)
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/tls/handshake_client_tls13.go:91 +0x1bc fp=0x1400013bac0 sp=0x1400013ba80 pc=0x102900b7c
crypto/tls.(*Conn).clientHandshake(0x14000098000, {0x102a5ca78, 0x140000a0040})
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/tls/handshake_client.go:224 +0x440 fp=0x1400013bd50 sp=0x1400013bac0 pc=0x1028fc7e0
crypto/tls.(*Conn).clientHandshake-fm({0x102a5ca78?, 0x140000a0040?})
:1 +0x3c fp=0x1400013bd80 sp=0x1400013bd50 pc=0x10291d9dc
crypto/tls.(*Conn).handshakeContext(0x14000098000, {0x102a5cab0, 0x1400012e008})
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/tls/conn.go:1462 +0x2dc fp=0x1400013bf60 sp=0x1400013bd80 pc=0x1028faf0c
crypto/tls.(*Conn).HandshakeContext(...)
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/tls/conn.go:1405
net/http.(*persistConn).addTLS.func2()
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/transport.go:1538 +0x6c fp=0x1400013bfd0 sp=0x1400013bf60 pc=0x10296cb8c
runtime.goexit()
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/asm_arm64.s:1165 +0x4 fp=0x1400013bfd0 sp=0x1400013bfd0 pc=0x102807164
created by net/http.(*persistConn).addTLS
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/transport.go:1534 +0x2cc
goroutine 34 [syscall]:
crypto/x509/internal/macos.syscall(0x14000100000?, 0x140000ba1e0?, 0x1400013b1e8?, 0x1027d7378?, 0x1400013b1b8?, 0x1028dfd20?, 0x102a34420?)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/sys_darwin.go:99 +0x5c fp=0x1400013b150 sp=0x1400013b0b0 pc=0x102803d1c
crypto/x509/internal/macos.CFRelease(0x140000ba1e0?)
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/x509/internal/macos/corefoundation.go:156 +0x40 fp=0x1400013b1a0 sp=0x1400013b150 pc=0x1028df930
crypto/x509/internal/macos.ReleaseCFArray(0x1400013b228?)
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/x509/internal/macos/corefoundation.go:211 +0x30 fp=0x1400013b1d0 sp=0x1400013b1a0 pc=0x1028dfbc0
crypto/x509.(*Certificate).systemVerify.func2()
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/x509/root_darwin.go:34 +0x28 fp=0x1400013b1f0 sp=0x1400013b1d0 pc=0x1028e77a8
runtime.deferreturn()
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/panic.go:476 +0x34 fp=0x1400013b230 sp=0x1400013b1f0 pc=0x1027d7384
crypto/x509.(*Certificate).systemVerify(0x140000d8000, 0x1400013b5f0)
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/x509/root_darwin.go:40 +0x360 fp=0x1400013b490 sp=0x1400013b230 pc=0x1028e72a0
crypto/x509.(*Certificate).Verify(0x140000d8000, {{0x1400012e290, 0xa}, 0x140000927e0, 0x0, {0xc0b906432398fdc8, 0x327a142, 0x102bc0fe0}, {0x0, 0x0, ...}, ...})
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/x509/verify.go:768 +0x474 fp=0x1400013b5e0 sp=0x1400013b490 pc=0x1028eaca4
crypto/tls.(*Conn).verifyServerCertificate(0x14000098000, {0x140000914a0, 0x3, 0x4})
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/tls/handshake_client.go:874 +0x4fc fp=0x1400013b870 sp=0x1400013b5e0 pc=0x1029001ac
crypto/tls.(*clientHandshakeStateTLS13).readServerCertificate(0x1400013bc78)
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/tls/handshake_client_tls13.go:461 +0x274 fp=0x1400013ba80 sp=0x1400013b870 pc=0x102902754
crypto/tls.(*clientHandshakeStateTLS13).handshake(0x1400013bc78)
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/tls/handshake_client_tls13.go:91 +0x1bc fp=0x1400013bac0 sp=0x1400013ba80 pc=0x102900b7c
crypto/tls.(*Conn).clientHandshake(0x14000098000, {0x102a5ca78, 0x140000a0040})
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/tls/handshake_client.go:224 +0x440 fp=0x1400013bd50 sp=0x1400013bac0 pc=0x1028fc7e0
crypto/tls.(*Conn).clientHandshake-fm({0x102a5ca78?, 0x140000a0040?})
:1 +0x3c fp=0x1400013bd80 sp=0x1400013bd50 pc=0x10291d9dc
crypto/tls.(*Conn).handshakeContext(0x14000098000, {0x102a5cab0, 0x1400012e008})
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/tls/conn.go:1462 +0x2dc fp=0x1400013bf60 sp=0x1400013bd80 pc=0x1028faf0c
crypto/tls.(*Conn).HandshakeContext(...)
/opt/homebrew/Cellar/go/1.19/libexec/src/crypto/tls/conn.go:1405
net/http.(*persistConn).addTLS.func2()
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/transport.go:1538 +0x6c fp=0x1400013bfd0 sp=0x1400013bf60 pc=0x10296cb8c
runtime.goexit()
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/asm_arm64.s:1165 +0x4 fp=0x1400013bfd0 sp=0x1400013bfd0 pc=0x102807164
created by net/http.(*persistConn).addTLS
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/transport.go:1534 +0x2cc
goroutine 1 [select]:
runtime.gopark(0x1400013f7b0?, 0x4?, 0xe8?, 0xf4?, 0x1400013f658?)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/proc.go:363 +0xe4 fp=0x1400013f4c0 sp=0x1400013f4a0 pc=0x1027db014
runtime.selectgo(0x1400013f7b0, 0x1400013f650, 0x1400011ad20?, 0x0, 0x1400013f628?, 0x1)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/select.go:328 +0x688 fp=0x1400013f5e0 sp=0x1400013f4c0 pc=0x1027ead78
net/http.(*Transport).getConn(0x102bbb7c0, 0x140001581c0, {{}, 0x0, {0x102980a38, 0x5}, {0x1400012e290, 0xe}, 0x0})
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/transport.go:1376 +0x448 fp=0x1400013f800 sp=0x1400013f5e0 pc=0x10296b588
net/http.(*Transport).roundTrip(0x102bbb7c0, 0x1400017a000)
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/transport.go:582 +0x658 fp=0x1400013fa30 sp=0x1400013f800 pc=0x102967978
net/http.(*Transport).RoundTrip(0x10?, 0x102a5ab80?)
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/roundtrip.go:17 +0x1c fp=0x1400013fa50 sp=0x1400013fa30 pc=0x10295f12c
net/http.send(0x1400017a000, {0x102a5ab80, 0x102bbb7c0}, {0x10293fd8c?, 0x8?, 0x0?})
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/client.go:251 +0x4f4 fp=0x1400013fc50 sp=0x1400013fa50 pc=0x10293e634
net/http.(*Client).send(0x102bc0d40, 0x1400017a000, {0x1400013fd08?, 0x1027b118c?, 0x0?})
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/client.go:175 +0x98 fp=0x1400013fcd0 sp=0x1400013fc50 pc=0x10293dfd8
net/http.(*Client).do(0x102bc0d40, 0x1400017a000)
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/client.go:715 +0x6e8 fp=0x1400013fed0 sp=0x1400013fcd0 pc=0x10293fde8
net/http.(*Client).Do(...)
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/client.go:581
net/http.(*Client).Get(0x1027a5514?, {0x102980a38?, 0x1400004a768?})
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/client.go:479 +0x78 fp=0x1400013ff30 sp=0x1400013fed0 pc=0x10293f5f8
net/http.Get(...)
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/client.go:448
main.main()
/var/folders/cy/3r4j16gn1zv67w4pxmf7kwjr0000gn/T/tmp.ycttMIXQ/main.go:10 +0x34 fp=0x1400013ff70 sp=0x1400013ff30 pc=0x10297c834
runtime.main()
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/proc.go:250 +0x24c fp=0x1400013ffd0 sp=0x1400013ff70 pc=0x1027dac4c
runtime.goexit()
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/asm_arm64.s:1165 +0x4 fp=0x1400013ffd0 sp=0x1400013ffd0 pc=0x102807164
goroutine 2 [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/proc.go:363 +0xe4 fp=0x1400004afa0 sp=0x1400004af80 pc=0x1027db014
runtime.goparkunlock(...)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/proc.go:369
runtime.forcegchelper()
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/proc.go:302 +0xac fp=0x1400004afd0 sp=0x1400004afa0 pc=0x1027daeac
runtime.goexit()
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/asm_arm64.s:1165 +0x4 fp=0x1400004afd0 sp=0x1400004afd0 pc=0x102807164
created by runtime.init.6
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/proc.go:290 +0x24
goroutine 3 [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/proc.go:363 +0xe4 fp=0x1400004b770 sp=0x1400004b750 pc=0x1027db014
runtime.goparkunlock(...)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/proc.go:369
runtime.bgsweep(0x0?)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/mgcsweep.go:278 +0xa4 fp=0x1400004b7b0 sp=0x1400004b770 pc=0x1027c8534
runtime.gcenable.func1()
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/mgc.go:178 +0x28 fp=0x1400004b7d0 sp=0x1400004b7b0 pc=0x1027bcd78
runtime.goexit()
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/asm_arm64.s:1165 +0x4 fp=0x1400004b7d0 sp=0x1400004b7d0 pc=0x102807164
created by runtime.gcenable
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/mgc.go:178 +0x74
goroutine 4 [GC scavenge wait]:
runtime.gopark(0x14000072000?, 0x1029f1850?, 0x1?, 0x0?, 0x0?)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/proc.go:363 +0xe4 fp=0x1400004bf50 sp=0x1400004bf30 pc=0x1027db014
runtime.goparkunlock(...)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/proc.go:369
runtime.(*scavengerState).park(0x102bc1060)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/mgcscavenge.go:389 +0x5c fp=0x1400004bf80 sp=0x1400004bf50 pc=0x1027c64ec
runtime.bgscavenge(0x0?)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/mgcscavenge.go:617 +0x44 fp=0x1400004bfb0 sp=0x1400004bf80 pc=0x1027c6a94
runtime.gcenable.func2()
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/mgc.go:179 +0x28 fp=0x1400004bfd0 sp=0x1400004bfb0 pc=0x1027bcd18
runtime.goexit()
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/asm_arm64.s:1165 +0x4 fp=0x1400004bfd0 sp=0x1400004bfd0 pc=0x102807164
created by runtime.gcenable
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/mgc.go:179 +0xb8
goroutine 18 [finalizer wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/proc.go:363 +0xe4 fp=0x14000046580 sp=0x14000046560 pc=0x1027db014
runtime.goparkunlock(...)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/proc.go:369
runtime.runfinq()
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/mfinal.go:180 +0x120 fp=0x140000467d0 sp=0x14000046580 pc=0x1027bbfa0
runtime.goexit()
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/asm_arm64.s:1165 +0x4 fp=0x140000467d0 sp=0x140000467d0 pc=0x102807164
created by runtime.createfing
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/mfinal.go:157 +0x84
goroutine 19 [chan receive]:
runtime.gopark(0x102bf1c60?, 0x102cfc5e0?, 0x78?, 0x17?, 0x1027b133c?)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/proc.go:363 +0xe4 fp=0x140001416f0 sp=0x140001416d0 pc=0x1027db014
runtime.chanrecv(0x14000090060, 0x140001418d8, 0x1)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/chan.go:583 +0x454 fp=0x14000141780 sp=0x140001416f0 pc=0x1027aaa54
runtime.chanrecv1(0x1400017e000?, 0x1400009a010?)
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/chan.go:442 +0x14 fp=0x140001417b0 sp=0x14000141780 pc=0x1027aa5f4
net/http.(*persistConn).addTLS(0x1400014c480, {0x102a5cab0?, 0x1400012e008}, {0x1400012e290, 0xa}, 0x0)
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/transport.go:1544 +0x2dc fp=0x140001419a0 sp=0x140001417b0 pc=0x10296c93c
net/http.(*Transport).dialConn(0x102bbb7c0, {0x102a5cab0, 0x1400012e008}, {{}, 0x0, {0x102980a38, 0x5}, {0x1400012e290, 0xe}, 0x0})
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/transport.go:1618 +0x780 fp=0x14000141ec0 sp=0x140001419a0 pc=0x10296d3f0
net/http.(*Transport).dialConnFor(0x0?, 0x1400015c2c0)
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/transport.go:1450 +0x80 fp=0x14000141fb0 sp=0x14000141ec0 pc=0x10296bfd0
net/http.(*Transport).queueForDial.func1()
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/transport.go:1419 +0x2c fp=0x14000141fd0 sp=0x14000141fb0 pc=0x10296bf1c
runtime.goexit()
/opt/homebrew/Cellar/go/1.19/libexec/src/runtime/asm_arm64.s:1165 +0x4 fp=0x14000141fd0 sp=0x14000141fd0 pc=0x102807164
created by net/http.(*Transport).queueForDial
/opt/homebrew/Cellar/go/1.19/libexec/src/net/http/transport.go:1419 +0x398
r0 0x0
r1 0x0
r2 0x0
r3 0x0
r4 0x0
r5 0x14000102f30
r6 0x102bf0db1
r7 0x1
r8 0x1980dee91
r9 0x1edebb000
r10 0x6000137d1968
r11 0x1
r12 0x1028e0540
r13 0x16d886f00
r14 0x1029f1850
r15 0x1f06ed8d8
r16 0x102b84000
r17 0x197ce8290
r18 0x0
r19 0xc
r20 0x1400013b230
r21 0x3
r22 0xd
r23 0x5a
r24 0x4e7b8f8b91b24de2
r25 0xd265af7a4013c97f
r26 0x1400013b2e8
r27 0x848
r28 0x140001021a0
r29 0x16d886ed0
lr 0x197ce839c
sp 0x16d886ed0
pc 0x197eb5458
fault 0x197eb5458
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
Running a compiled Go binary with a strange path causes crashes that are very similar to #51759, so perhaps the crash is rather in
crypto/x509than innet/http.I can only reproduce it when calling the Go binary with a path that includes a double slash
//and a directory that starts with a dot.. I have no idea why this is or how to further debug is.This reproducing script sets up a minimal folder structure, build the tool and runs it in a way that causes crashes:
Calling it e.g. with
$(pwd)/dir/../.dot/repro,$(pwd)//.dot/repro, or$(pwd)/.dot/reprodoes not cause the same crash.What did you expect to see?
HTML output from https://google.com.
What did you see instead?
Panic, see hidden long panic text below:
Full panic output
/cc @bradfitz
as you reported the very similar ticket #51759, would be interesting to see if you can reproduce this the same way.