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
pwhash_scrypt test fails (escrypt_kdf_nosse) in mmap with invalid mem size #890
Comments
|
Forgot to mention I have the exact same information in this related JIRA card: |
|
Is it with |
|
No, actually the problem has been identified in PyNaCl 1.3.0, which at this moment is the latest version available. I'm trying to setup a virtualenv with the cord-tester framework, which requires pynacl. |
|
The string from the test seen in your PyNaCl can probably use a system installation |
|
Sure, that makes sense. TBH I wasn't aware that portion of code disappeared, but l wanted to dump this info here anyway, because I noticed the other threads didn't really reach a conclusion to how it reproduces and what was going wrong. I will try to take this to the maintainers of PyNaCl, but as a side note, I think it makes sense for you to join forces with them and maybe even incorporate the python binding support in your repo. Thanks and regards, |
This issue is related to two other closed issues:
#721
#749
I encountered this problem on an aarch64 server, running Ubuntu 16.04, both in a Docker container and baremetal. First I fixed the ulimit max_memlock problem, increasing from 64k to 16384k. This made the test pass on one server, but when I switched to a different server I started getting memory depletion, as described on the second bug report mentioned above.
I started debugging the actual test case and found the following:
So here is the tricky part. On my second aarch64 server we used to run some virtualized work (Fuel/Openstack) which for some reason made necessary to specify a special vm.memory_overcommit value of 1. This means that the kernel will no longer perform sanity checks for mmap like syscalls. This is why in this case mmap will try to allocate and map the pages into memory.
I'm not sure whether the purpose of the test case is to verify situations like this, where an invalid encrypted text would require allocating an insane and incorrect amount of memory, but when it's also coupled with this kind of sysctl config for memory_overcommit, I consider it to be a vulnerability.
I'm also attaching a file with my debug session.
libsodium_pwhash_scrypt_dbg.txt
Thanks and regards,
/Ciprian
The text was updated successfully, but these errors were encountered: