summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-11-16 03:23:52 +0100
committerLennart Poettering <lennart@poettering.net>2010-11-16 03:23:52 +0100
commitb853f6e9d60c0eab2038227718ee1ed1266f94de (patch)
tree374d10f658479472ed9bf2fbd09b5db6d3fdff1a
parent967072694d4ebb1b7c5989b92aa71af48954a975 (diff)
cryptsetup: lock ourselves into memory as long as we deal with passwords
-rw-r--r--src/cryptsetup.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cryptsetup.c b/src/cryptsetup.c
index c007b87c7a..c103aa9e03 100644
--- a/src/cryptsetup.c
+++ b/src/cryptsetup.c
@@ -21,6 +21,7 @@
#include <string.h>
#include <errno.h>
+#include <sys/mman.h>
#include <libcryptsetup.h>
@@ -181,6 +182,9 @@ int main(int argc, char *argv[]) {
if (argc >= 6 && argv[5][0] && !streq(argv[5], "-"))
parse_options(argv[5]);
+ /* A delicious drop of snake oil */
+ mlockall(MCL_FUTURE);
+
if ((k = crypt_init(&cd, argv[3]))) {
log_error("crypt_init() failed: %s", strerror(-k));
goto finish;