]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cryptsetup: reduce the chance that we will be OOM killed
authorMichal Sekletár <msekleta@redhat.com>
Wed, 27 Nov 2019 13:27:58 +0000 (14:27 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 27 Nov 2019 17:34:36 +0000 (18:34 +0100)
cryptsetup introduced optional locking scheme that should serialize
unlocking keyslots which use memory hard key derivation
function (argon2). Using the serialization should prevent OOM situation
in early boot while unlocking encrypted volumes.

src/cryptsetup/cryptsetup.c

index 553b1afb4785962f1de32a853d7441dd4c5b13cc..8723eb4c0148968522bf9aaac02201828c2e91a4 100644 (file)
@@ -599,6 +599,12 @@ static uint32_t determine_flags(void) {
         if (arg_submit_from_crypt_cpus)
                 flags |= CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS;
 
+#ifdef CRYPT_ACTIVATE_SERIALIZE_MEMORY_HARD_PBKDF
+        /* Try to decrease the risk of OOM event if memory hard key derivation function is in use */
+        /* https://gitlab.com/cryptsetup/cryptsetup/issues/446/ */
+        flags |= CRYPT_ACTIVATE_SERIALIZE_MEMORY_HARD_PBKDF;
+#endif
+
         return flags;
 }