Skip to content

With go 1.20 enters an infinite loop while trying to generate (a deterministic) ECDSA key #69248

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

Closed
yogeshbdeshpande opened this issue Sep 4, 2024 · 4 comments

Comments

@yogeshbdeshpande
Copy link

Go version

go version go1.20.3 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/yogdes01/.cache/go-build"
GOENV="/home/yogdes01/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/yogdes01/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/yogdes01/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.20"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.20/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/yogdes01/veraison-ear/ear/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1650575872=/tmp/go-build -gno-record-gcc-switches"

What did you do?

ECDSA Key Generation Panics: i.e. ecdsa.GenerateKey() panics intermittently, when Randomness Source is all set to Zero.

Could it be because of:
https://go-review.googlesource.com/c/go/+/353849

What did you see happen?

Crash:

Full Trace see below:

go test -run TestAppraisalExtensions_SetGetKeyAttestation_ok --timeout 5s
panic: test timed out after 5s
running tests:
TestAppraisalExtensions_SetGetKeyAttestation_ok (5s)
goroutine 36 [running]:
testing.(*M).startAlarm.func1()
/usr/lib/go-1.20/src/testing/testing.go:2241 +0x3c5
created by time.goFunc
/usr/lib/go-1.20/src/time/sleep.go:176 +0x32
goroutine 1 [chan receive]:
testing.(*T).Run(0xc00013fa00, {0x8e0664?, 0x51caa5?}, 0x908118)
/usr/lib/go-1.20/src/testing/testing.go:1630 +0x405
testing.runTests.func1(0xc0adc0?)
/usr/lib/go-1.20/src/testing/testing.go:2036 +0x45
testing.tRunner(0xc00013fa00, 0xc000161c88)
/usr/lib/go-1.20/src/testing/testing.go:1576 +0x10b
testing.runTests(0xc000119220?, {0xc04200, 0x23, 0x23}, {0x20?, 0x100c000114d58?, 0xc0a3a0?})
/usr/lib/go-1.20/src/testing/testing.go:2034 +0x489
testing.(*M).Run(0xc000119220)
/usr/lib/go-1.20/src/testing/testing.go:1906 +0x63a
main.main()
_testmain.go:125 +0x1aa
goroutine 6 [select]:
[github.com/lestrrat-go/httprc.runFetchWorker({0x979f48](http://github.com/lestrrat-go/httprc.runFetchWorker(%7B0x979f48), 0xc000028078}, 0xc00007e540, {0x0, 0x0})
/home/yogdes01/go/pkg/mod/github.com/lestrrat-go/[email protected]/fetcher.go:135 +0xd3
created by github.com/lestrrat-go/httprc.NewFetcher
/home/yogdes01/go/pkg/mod/github.com/lestrrat-go/[email protected]/fetcher.go:75 +0x1ce
goroutine 7 [select]:
[github.com/lestrrat-go/httprc.runFetchWorker({0x979f48](http://github.com/lestrrat-go/httprc.runFetchWorker(%7B0x979f48), 0xc000028078}, 0xc00007e540, {0x0, 0x0})
/home/yogdes01/go/pkg/mod/github.com/lestrrat-go/[email protected]/fetcher.go:135 +0xd3
created by github.com/lestrrat-go/httprc.NewFetcher
/home/yogdes01/go/pkg/mod/github.com/lestrrat-go/[email protected]/fetcher.go:75 +0x1ce
goroutine 8 [select]:
[github.com/lestrrat-go/httprc.runFetchWorker({0x979f48](http://github.com/lestrrat-go/httprc.runFetchWorker(%7B0x979f48), 0xc000028078}, 0xc00007e540, {0x0, 0x0})
/home/yogdes01/go/pkg/mod/github.com/lestrrat-go/[email protected]/fetcher.go:135 +0xd3
created by github.com/lestrrat-go/httprc.NewFetcher
/home/yogdes01/go/pkg/mod/github.com/lestrrat-go/[email protected]/fetcher.go:75 +0x1ce
goroutine 9 [runnable]:
io.ReadAtLeast({0x9768c0, 0xc396a0}, {0xc000194280, 0x20, 0x20}, 0x20)
/usr/lib/go-1.20/src/io/io.go:326 +0x19c
io.ReadFull(...)
/usr/lib/go-1.20/src/io/io.go:351
crypto/ecdsa.randomPoint[...](0xc000024e40, {0x9768c0, 0xc396a0})
/usr/lib/go-1.20/src/crypto/ecdsa/ecdsa.go:202 +0xf2
crypto/ecdsa.generateNISTEC[...](0xc000024e40, {0x9768c0, 0xc396a0?})
/usr/lib/go-1.20/src/crypto/ecdsa/ecdsa.go:181 +0x37

crypto/ecdsa.GenerateKey({0x97a988, 0xbfb9c0}, {0x9768c0, 0xc396a0})
/usr/lib/go-1.20/src/crypto/ecdsa/ecdsa.go:170 +0x1c6

github.com/veraison/ear.TestAppraisalExtensions_SetGetKeyAttestation_ok(0x0?)
/home/yogdes01/veraison-ear/ear/ear_appraisal_test.go:22 +0x10c
testing.tRunner(0xc00013fba0, 0x908118)
/usr/lib/go-1.20/src/testing/testing.go:1576 +0x10b
created by testing.(*T).Run
/usr/lib/go-1.20/src/testing/testing.go:1629 +0x3ea
exit status 2
FAIL github.com/veraison/ear 5.194s

What did you expect to see?

Same as above, the test is stuck and times out leaving this crash trace!

@yogeshbdeshpande
Copy link
Author

Same problem is seen with any go 1.20.x version

@seankhliao
Copy link
Member

Duplicate of #58454

@seankhliao seankhliao marked this as a duplicate of #58454 Sep 4, 2024
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2024
@seankhliao
Copy link
Member

seankhliao commented Sep 4, 2024

see also #62255

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants