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

cmd/compile: panic during late opt while compiling (*ecdheKeyAgreement).processServerKeyExchange #27142

Open
mvdan opened this Issue Aug 22, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@mvdan
Copy link
Member

mvdan commented Aug 22, 2018

darwin-amd64-race at 64f3d75

https://build.golang.org/log/c2d6822a46b0e167cd2514e8553270f2a916ffcc

# crypto/tls [crypto/tls.test]
/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/crypto/tls/key_agreement.go:292:20: internal compiler error: '(*ecdheKeyAgreement).processServerKeyExchange': panic during late opt while compiling (*ecdheKeyAgreement).processServerKeyExchange:

runtime error: invalid memory address or nil pointer dereference

goroutine 1 [running]:
cmd/compile/internal/ssa.Compile.func1(0xc001a1ea28, 0xc0015c2000)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/ssa/compile.go:38 +0xc6
panic(0x184a0a0, 0x1eefa20)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/runtime/panic.go:513 +0x1b9
cmd/compile/internal/ssa.rewriteValuegeneric_OpNeq64_0(0xc00134ab30, 0x30)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/ssa/rewritegeneric.go:20251 +0x742
cmd/compile/internal/ssa.rewriteValuegeneric(0xc00134ab30, 0x0)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/ssa/rewritegeneric.go:293 +0x15a3
cmd/compile/internal/ssa.applyRewrite(0xc0015c2000, 0x18c8150, 0x18c81b0)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/ssa/rewrite.go:78 +0x351
cmd/compile/internal/ssa.opt(0xc0015c2000)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/ssa/opt.go:9 +0x43
cmd/compile/internal/ssa.Compile(0xc0015c2000)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/ssa/compile.go:70 +0x30e
cmd/compile/internal/gc.buildssa(0xc0009e2b00, 0x0, 0x0)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/gc/ssa.go:212 +0xab0
cmd/compile/internal/gc.compileSSA(0xc0009e2b00, 0x0)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/gc/pgen.go:259 +0x39
cmd/compile/internal/gc.compile(0xc0009e2b00)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/gc/pgen.go:238 +0x1a0
cmd/compile/internal/gc.funccompile(0xc0009e2b00)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/gc/pgen.go:209 +0xbd
cmd/compile/internal/gc.Main(0x18c7b00)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/gc/main.go:641 +0x2670
main.main()
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/main.go:51 +0x96



goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/runtime/debug/stack.go:24 +0xa7
cmd/compile/internal/gc.Fatalf(0xc0006b8340, 0x32, 0xc0003c5590, 0x5, 0x5)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/gc/subr.go:182 +0x1f7
cmd/compile/internal/gc.(*ssafn).Fatalf(0xc0014c6c90, 0x1241400000000a, 0x18bf0d0, 0x2c, 0xc00176fc00, 0x4, 0x4)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/gc/ssa.go:5606 +0x1dd
cmd/compile/internal/ssa.(*Func).Fatalf(0xc0015c2000, 0x18bf0d0, 0x2c, 0xc00176fc00, 0x4, 0x4)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/ssa/func.go:575 +0x73
cmd/compile/internal/ssa.Compile.func1(0xc001a1ea28, 0xc0015c2000)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/ssa/compile.go:40 +0x23a
panic(0x184a0a0, 0x1eefa20)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/runtime/panic.go:513 +0x1b9
cmd/compile/internal/ssa.rewriteValuegeneric_OpNeq64_0(0xc00134ab30, 0x30)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/ssa/rewritegeneric.go:20251 +0x742
cmd/compile/internal/ssa.rewriteValuegeneric(0xc00134ab30, 0x0)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/ssa/rewritegeneric.go:293 +0x15a3
cmd/compile/internal/ssa.applyRewrite(0xc0015c2000, 0x18c8150, 0x18c81b0)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/ssa/rewrite.go:78 +0x351
cmd/compile/internal/ssa.opt(0xc0015c2000)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/ssa/opt.go:9 +0x43
cmd/compile/internal/ssa.Compile(0xc0015c2000)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/ssa/compile.go:70 +0x30e
cmd/compile/internal/gc.buildssa(0xc0009e2b00, 0x0, 0x0)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/gc/ssa.go:212 +0xab0
cmd/compile/internal/gc.compileSSA(0xc0009e2b00, 0x0)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/gc/pgen.go:259 +0x39
cmd/compile/internal/gc.compile(0xc0009e2b00)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/gc/pgen.go:238 +0x1a0
cmd/compile/internal/gc.funccompile(0xc0009e2b00)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/gc/pgen.go:209 +0xbd
cmd/compile/internal/gc.Main(0x18c7b00)
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/internal/gc/main.go:641 +0x2670
main.main()
	/private/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/go/src/cmd/compile/main.go:51 +0x96

FAIL	crypto/tls [build failed]

Seems to be a spurious failure, as the darwin-amd64-race builder column is mostly green.

cc @randall77

This reminds me - https://dev.golang.org/owners/ needs a distinction as to who owns cmd/compile/internal/gc and cmd/compile/internal/ssa.

@mvdan mvdan added this to the Go1.12 milestone Aug 22, 2018

@mvdan

This comment has been minimized.

Copy link
Member Author

mvdan commented Sep 5, 2018

Another one, this time on linux-mipsle. This seems to affect multiple or all environments.

@randall77

This comment has been minimized.

Copy link
Contributor

randall77 commented Sep 15, 2018

The testfloat failure is unrelated.

I'm confused by the error report. I synced to 64f3d75 and built the compiler on darwin/amd64. The fault location cmd/compile/internal/ssa/rewritegeneric.go:20251 +0x742 is in the middle of an instruction, which doesn't make much sense. Unfortunately the report doesn't have the address that was faulted on.

00000000016039f0 <cmd/compile/internal/ssa.rewriteValuegeneric_OpNeq64_0>:
...
 1604128:       c6 84 24 e8 00 00 00    movb   $0x1,0xe8(%rsp)
 160412f:       01 
 1604130:       48 8b ac 24 d0 00 00    mov    0xd0(%rsp),%rbp
 1604137:       00 
 1604138:       48 81 c4 d8 00 00 00    add    $0xd8,%rsp
 160413f:       c3                      retq   

0x16039f0+0x742 = 0x1604132.
If you decode the instruction starting at 0x1604132, it is an instruction that could fault:

lods   %ds:(%rsi),%al

Maybe the pc is being corrupted and happens to land here? Seems unlikely, as the rest of the stack trace looks correct.

@odeke-em

This comment has been minimized.

Copy link
Member

odeke-em commented Jan 20, 2019

@randall77 unfortunately from the stack-trace, examining the source code doesn't make sense either on 64f3d75 or perhaps that's due to using -race?

Firstly:

crypto/tls/key_agreement.go:292:20

if len(skx.key) < 4 {

and then when rewriting the value using rewriteValueGeneric

return rewriteValuegeneric_OpNeq64_0(v)

all don't seem to be invoking anything that can panic. Perhaps some ideas on why this looks skewed?

@andybons andybons modified the milestones: Go1.12, Go1.13 Feb 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.