So, when running cryptonite’s test suite with -KmK
(Neil Mitchell has a blogpost!) I get:
cabal run test-cryptonite -- -p ECDSA +RTS -K32K
cryptonite
PubKey
ECDSA
SHA1
signature
0: OK
1: OK
2: OK
3: OK (0.01s)
4: OK (0.01s)
verify
0: OK
1: OK (0.02s)
2: OK (0.02s)
3: OK (0.02s)
4: OK (0.02s)
SHA224
signature
0: OK
1: OK
2: OK
3: OK
4: OK
5: OK
6: OK
7: OK
8: OK
9: OK
verify
0: OK
1: OK
2: OK
3: OK
4: OK
5: OK
6: OK
7: OK
8: FAIL
Exception: stack overflow
Use -p '/ECDSA/&&/SHA224.verify.8/' to rerun this test only.
9: FAIL
Exception: stack overflow
Use -p '/ECDSA/&&/SHA224.verify.9/' to rerun this test only.
SHA256
signature
0: OK
1: OK
2: OK
3: OK
4: OK
5: OK
6: OK
7: OK
8: OK
9: OK
verify
0: OK
1: OK
2: OK
3: OK
4: OK
5: OK
6: OK
7: OK
8: FAIL
Exception: stack overflow
Use -p '/ECDSA/&&/SHA256.verify.8/' to rerun this test only.
9: FAIL
Exception: stack overflow
Use -p '/ECDSA/&&/SHA256.verify.9/' to rerun this test only.
SHA384
signature
0: OK
1: OK
2: OK
3: OK
4: OK
5: OK
6: OK
7: OK
8: OK
9: OK
verify
0: OK
1: OK
2: OK
3: OK
4: OK
5: OK
6: OK
7: OK
8: FAIL
Exception: stack overflow
Use -p '/ECDSA/&&/SHA384.verify.8/' to rerun this test only.
9: FAIL
Exception: stack overflow
Use -p '/ECDSA/&&/SHA384.verify.9/' to rerun this test only.
SHA512
signature
0: OK
1: OK
2: OK
3: OK
4: OK
5: OK
6: OK
7: OK
8: OK
9: OK
verify
0: OK
1: OK
2: OK
3: OK
4: OK
5: OK
6: OK
7: OK
8: FAIL
Exception: stack overflow
Use -p '/ECDSA/&&/SHA512.verify.8/' to rerun this test only.
9: FAIL
Exception: stack overflow
Use -p '/ECDSA/&&/SHA512.verify.9/' to rerun this test only.
ECDSA
SHA1: FAIL
Exception: stack overflow
Use -p '/ECDSA/&&/cryptonite.ECDSA.SHA1/' to rerun this test only.
SHA224: FAIL
Exception: stack overflow
Use -p '/ECDSA/&&/cryptonite.ECDSA.SHA224/' to rerun this test only.
SHA256: FAIL
Exception: stack overflow
Use -p '/ECDSA/&&/cryptonite.ECDSA.SHA256/' to rerun this test only.
SHA384: FAIL
Exception: stack overflow
Use -p '/ECDSA/&&/cryptonite.ECDSA.SHA384/' to rerun this test only.
SHA512: FAIL
Exception: stack overflow
Use -p '/ECDSA/&&/cryptonite.ECDSA.SHA512/' to rerun this test only.
13 out of 95 tests failed (0.43s)
(basically, stack overflows in ECDSA stuff). Here is the stack trace:
Exception: stack overflow
Use -p '/ECDSA/&&/cryptonite.ECDSA.SHA384/' to rerun this test only.
SHA512: *** Exception (reporting due to +RTS -xc): (IND_STATIC), stack trace:
Crypto.ECC.Simple.Prim.pointAddTwoMuls,
called from Crypto.PubKey.ECDSA.verifyDigest,
called from Crypto.PubKey.ECDSA.verify,
(i.e. maybe pointAddTwoMuls
, otherwise verifyDigest
)
Looking at the heap profile, it looks like a large share of the space is dedicated to thunks! Which makes it more suspect!
How do I confirm this is a real thunk leak? Is this a bug?