strange failure of golang.org/x/crypto/argon2.IDKey

81 views
Skip to first unread message

andre.k...@gmail.com

unread,
Jan 3, 2020, 2:14:22 AM1/3/20
to golang-nuts

I attached a minimal test program to reproduce an issue with golang.org/x/crypto/argon2.

It calls IDKey twice with the same parameters. The first call executes, but during the second call the program crashes.

Strange thing: The program does not always crash. If it crashes then I can call it multiple times in a row and it always crashes.
But then maybe if I try a few hours later it does not crash. And if I try it then again and again it will always work normally.

Another curious thing is that when it crashes it usually (but not always) kills the whole terminal emulator (gnome-terminal) with it.
I am running this on Fedora 31 64-bit (Intel Core i5-5200U).
strace shows at the end:

    +++ killed by SIGKILL +++

The crash happens somewhere in the argon2.processBlocks function.

Any ideas ? Should I open an issue on https://github.com/golang/go ?


main.go

Kurtis Rader

unread,
Jan 3, 2020, 1:20:39 PM1/3/20
to andre.k...@gmail.com, golang-nuts
The SIGKILL coupled with your terminal emulator also being killed suggests an OOM, out of memory, situation that causes the kernel to kill processes to keep the entire system from dying. You're probably not correctly initializing the state of the crypto code on subsequent calls.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/e39ef554-b764-4a90-b5a1-f5b1054dfed3%40googlegroups.com.


--
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

Ren Thraysk

unread,
Jan 3, 2020, 7:23:57 PM1/3/20
to golang-nuts

Memory parameter to IDKey is in kilobytes. Your code is specifying 2000000 kilobytes.

Ren

andre.k...@gmail.com

unread,
Jan 4, 2020, 2:59:43 AM1/4/20
to golang-nuts
Thanks Kurtis and Ren, now I see that the memory usage seems very high indeed.

I was just debugging this issue I had with https://github.com/avahowell/masterkey.
I will open an issue there to ask why this memory parameter has been set so high.

Reply all
Reply to author
Forward
0 new messages