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

bytes/hash: TestSmhasherSmallKeys flake on android-arm-corellium builder #34834

bcmills opened this issue Oct 11, 2019 · 2 comments


Copy link

@bcmills bcmills commented Oct 11, 2019

From the android-arm-corellium builder (

--- FAIL: TestSmhasherSmallKeys (0.15s)
    smhasher_test.go:95: unexpected number of collisions: got=256 mean=0.000000 stddev=0.000011
FAIL	bytes/hash	0.639s

CC @randall77

@bcmills bcmills added this to the Go1.14 milestone Oct 11, 2019

This comment has been minimized.

Copy link

@randall77 randall77 commented Oct 13, 2019

I think what is going on here is that we're getting invalid random data on startup (_AT_RANDOM content not actually random, or perhaps zero length, or no _AT_RANDOM and /dev/urandom isn't random).
I can reproduce the behavior on 386 by setting GODEBUG=cpu.all=off (to get the same hash algorithm that arm uses) and commenting out the call to getRandomData in runtime/alg.go:alginit.

We use different parts of the startup random data to make the hash length-dependent. If the startup random data is not random (all zero, probably) then the length-dependence of the hash goes away, and that's the behavior we're seeing (the 256 length 1 hashes are colliding with some of the 256^2 length 2 hashes).


This comment has been minimized.

Copy link

@randall77 randall77 commented Oct 14, 2019

I guess this could happen by chance with probability ~2^-16 (top ~16 bits of two 32-bit random numbers differ by a one-bit shift).

It hasn't recurred. I'm inclined to leave this as is and see if it happens again.

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