ProtonMail/go-crypto

Tests fail on ppc64el with panic: runtime error: invalid memory address or nil pointer dereference [recovered]

pravi opened this issue · 1 comments

pravi commented

We are happy to answer your questions about the code or discuss technical ideas.

Please complete the following checklist (by adding [x]):

  • I have searched open and closed issues for duplicates
  • This isn't a feature request
  • This is not a report about my app not working as expected

Some tests are failing on ppc64el architecture.

=== RUN   TestP256t1
--- FAIL: TestP256t1 (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x11694c]

goroutine 18 [running]:
testing.tRunner.func1.2({0x142a00, 0x246950})
	/usr/lib/go-1.17/src/testing/testing.go:1209 +0x27c
testing.tRunner.func1(0xc000083380)
	/usr/lib/go-1.17/src/testing/testing.go:1212 +0x228
panic({0x142a00, 0x246950})
	/usr/lib/go-1.17/src/runtime/panic.go:1038 +0x240
crypto/elliptic.matchesSpecificCurve(0xc0000ac6c0, {0xc00009add0, 0x3, 0x3})
	/usr/lib/go-1.17/src/crypto/elliptic/elliptic.go:45 +0x7c
crypto/elliptic.(*CurveParams).ScalarBaseMult(0xc0000ac6c0, {0xc0000e2020, 0x20, 0x20})
	/usr/lib/go-1.17/src/crypto/elliptic/elliptic.go:313 +0xbc
crypto/ecdsa.GenerateKey({0x1901c0, 0xc0000ac6c0}, {0x18d3c0, 0xc0000a21e0})
	/usr/lib/go-1.17/src/crypto/ecdsa/ecdsa.go:158 +0x168
github.com/ProtonMail/go-crypto/brainpool.testCurve(0xc000083380, {0x1901c0, 0xc0000ac6c0})
	/tmp/autopkgtest-lxc.bl6ydmwq/downtmp/autopkgtest_tmp/_build/src/github.com/ProtonMail/go-crypto/brainpool/brainpool_test.go:11 +0x50
github.com/ProtonMail/go-crypto/brainpool.TestP256t1(0xc000083380)
	/tmp/autopkgtest-lxc.bl6ydmwq/downtmp/autopkgtest_tmp/_build/src/github.com/ProtonMail/go-crypto/brainpool/brainpool_test.go:28 +0x80
testing.tRunner(0xc000083380, 0x1687f8)
	/usr/lib/go-1.17/src/testing/testing.go:1259 +0xf0
created by testing.(*T).Run
	/usr/lib/go-1.17/src/testing/testing.go:1306 +0x370
FAIL	github.com/ProtonMail/go-crypto/brainpool	0.011s

Full log at https://ci.debian.net/data/autopkgtest/testing/ppc64el/g/golang-github-protonmail-go-crypto/16755345/log.gz

twiss commented

Hello 👋 Thanks for the report! As far as I can tell, this is a bug in Go: in src/crypto/elliptic/p256_ppc64le.go, p256 gets initialized to nil, unlike all other platforms, and it only gets initialized on usage. Since this is a test for brainpool, p256 never gets initialized and elliptic.go later panics.

Do you have a test machine where I can test this? (I tried ssh'ing to this machine but got Permission denied (publickey)).
Alternatively, could you open a bug report in golang/go? (They ask some questions about the environment etc.)