summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Davis <smd.seandavis@gmail.com>2019-10-19 19:01:09 -0400
committerSean Davis <smd.seandavis@gmail.com>2019-10-19 19:01:09 -0400
commitdcde7fe868f7cc79956a715e91966fae64dec884 (patch)
tree2239e7c1bf7a1ed6fcf6016a85ae24ab17d97571 /src
parentf76272ed3f3d043fcaca8116042fa620fb284abd (diff)
downloadlightdm-gtk-greeter-git-dcde7fe868f7cc79956a715e91966fae64dec884.tar.gz
Remove mlockall.
Protect memory from being paged to disk, as we deal with passwords According to systemd-dev, "mlockall() is generally a bad idea and certainly has no place in a graphical program. A program like this uses lots of memory and it is crucial that this memory can be paged out to relieve memory pressure." With systemd version 239 the ulimit for RLIMIT_MEMLOCK was set to 16 MiB and therefore the mlockall call would fail. This is lucky becasue the subsequent mmap would not fail. With systemd version 240 the RLIMIT_MEMLOCK is now set to 64 MiB and now the mlockall no longer fails. However, it not possible to mmap in all the memory and because that would still exceed the MEMLOCK limit. " See https://bugzilla.redhat.com/show_bug.cgi?id=1662857 & canonical/lightdm#55 RLIMIT_MEMLOCK = 64 MiB means, arctica-greeter will most likely fail with 64 bit and will always fail on 32 bit systems. Hence we better disable it. Ported from Unity Greeter / Slick Greeter / Artica Greeter https://bugs.launchpad.net/ubuntu/+source/unity-greeter/+bug/1815493 linuxmint/slick-greeter#127
Diffstat (limited to 'src')
-rw-r--r--src/lightdm-gtk-greeter.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/lightdm-gtk-greeter.c b/src/lightdm-gtk-greeter.c
index aa1c4cb..27d009f 100644
--- a/src/lightdm-gtk-greeter.c
+++ b/src/lightdm-gtk-greeter.c
@@ -2748,8 +2748,30 @@ main (int argc, char **argv)
guint fallback_css_priority = GTK_STYLE_PROVIDER_PRIORITY_APPLICATION;
GtkIconTheme *icon_theme;
- /* Prevent memory from being swapped out, as we are dealing with passwords */
- mlockall (MCL_CURRENT | MCL_FUTURE);
+ /* Protect memory from being paged to disk, as we deal with passwords
+
+ According to systemd-dev,
+
+ "mlockall() is generally a bad idea and certainly has no place in a graphical program.
+ A program like this uses lots of memory and it is crucial that this memory can be paged
+ out to relieve memory pressure."
+
+ With systemd version 239 the ulimit for RLIMIT_MEMLOCK was set to 16 MiB
+ and therefore the mlockall call would fail. This is lucky becasue the subsequent mmap would not fail.
+
+ With systemd version 240 the RLIMIT_MEMLOCK is now set to 64 MiB
+ and now the mlockall no longer fails. However, it not possible to mmap in all
+ the memory and because that would still exceed the MEMLOCK limit.
+ "
+ See https://bugzilla.redhat.com/show_bug.cgi?id=1662857 &
+ https://github.com/CanonicalLtd/lightdm/issues/55
+
+ RLIMIT_MEMLOCK = 64 MiB means, arctica-greeter will most likely fail with 64 bit and
+ will always fail on 32 bit systems.
+
+ Hence we better disable it. */
+
+ /*mlockall (MCL_CURRENT | MCL_FUTURE);*/
g_message ("Starting %s (%s, %s)", PACKAGE_STRING, __DATE__, __TIME__);