]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
but do use mlockall in session-child mode
authorMichael Terry <michael.terry@canonical.com>
Mon, 28 Jan 2013 17:22:20 +0000 (12:22 -0500)
committerMichael Terry <michael.terry@canonical.com>
Mon, 28 Jan 2013 17:22:20 +0000 (12:22 -0500)
src/session-child.c

index dc755990f02fa59dd46d8f58847f10851c581b1a..d5a136f6cf979286b5230de3443fd05b45d20ccc 100644 (file)
@@ -12,6 +12,7 @@
 #include <glib.h>
 #include <security/pam_appl.h>
 #include <utmpx.h>
+#include <sys/mman.h>
 
 #include "session-child.h"
 #include "session.h"
@@ -196,6 +197,12 @@ session_child_run (int argc, char **argv)
     g_type_init ();
 #endif
 
+    if (config_get_boolean (config_get_instance (), "LightDM", "lock-memory"))
+    {
+        /* Protect memory from being paged to disk, as we deal with passwords */
+        mlockall (MCL_CURRENT | MCL_FUTURE);
+    }
+
     /* Make input non-blocking */
     fd = open ("/dev/null", O_RDONLY);
     dup2 (fd, STDIN_FILENO);