The OOM killer issue that's mentioned in #19 (closed) most likely is due to the fact that unlocking LUKS2 devices with argon2 as KDF eats a lot of memory. According to @guilhem, argon2 memory usage is capped at 1G. @guilhem, do you have a reference?
In any case, we should check whether one of the to-be-processed devices is a LUKS2 device with argon2 as KDF and if there's enough memory available.
Edited
Designs
Child items
...
Show closed items
Linked items
0
Link issues together to show that they're related.
Learn more.
I've not seen it documented, but the memory cost will be also be lowered not to exceed half of the physical memory, otherwise devices couldn't be unlocked on systems with <1GiB RAM. (See also #924560#15.) So AFAICT the actual default memory cost is
min(phys_memory/2, 1GiB)
. Problems arise when the second half of the memory is not enough for the rest of the system; or when multiple LUKS2 devices are being unlocked in parallel, as Dimitri reported.
I went with a first implementation that takes the default memory usage for argon2i keyslots: e303e291
A cleaner approach would be to iterate over all LUKS devices, try to get the actual memory usage values for all keyslots and take the maximum amount of them. But that's cumbersome and also further increases the runtime of cryptsetup-suspend.c.
Our assumption is that non-argon2i hashing algorithms (like PBKDF2) also need some memory. Though, 2MB is a randomly picked value and we definitely need to find a sensible value here.