[Git][NTPsec/ntpsec][master] Do not attempt to lock ntpd into memory.

Eric S. Raymond gitlab at mg.gitlab.com
Mon Jun 27 21:47:27 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
35da103d by Eric S. Raymond at 2016-06-27T17:40:10-04:00
Do not attempt to lock ntpd into memory.

This had a bad interaction with the async-DNS code that leads to
sporadic crashes. There are some possible fixes that add code
complexity in Classic, but the right thing to do is (a) notice that
this call is pretty useless on modern systems, which swap so seldom
that many people don't bother with swap partitions, and (b) simplify
by dropping the code.

One good reason to retain this might have been crypto security.  But
our crypto geek says: "Some people like to use memory locking to make
sure that intermediate results of crypto computations don't get
written to swap and sit there long-term. But that's only useful if
you're not already storing keys on disk (rather than on, say, an HSM),
and we don't support any alternative to that."

- - - - -


3 changed files:

- include/ntp_config.h
- ntpd/ntp_config.c
- ntpd/ntpd.c


Changes:

=====================================
include/ntp_config.h
=====================================
--- a/include/ntp_config.h
+++ b/include/ntp_config.h
@@ -33,9 +33,6 @@ extern	int	cmdline_server_count;
 extern	char **	cmdline_servers;
 extern	bool	force_synchronous_dns;
 
-/* set to false if admin doesn't want memory locked */
-extern	bool	do_memlock;
-
 typedef struct int_range_tag {
 	int	first;
 	int	last;


=====================================
ntpd/ntp_config.c
=====================================
--- a/ntpd/ntp_config.c
+++ b/ntpd/ntp_config.c
@@ -74,9 +74,6 @@ int	cmdline_server_count;
 char **	cmdline_servers;
 bool	force_synchronous_dns;
 
-/* set to false if admin doesn't want memory locked */
-bool	do_memlock = true;
-
 /*
  * FIXME: ugly globals, only created to avoid wiring in option-parsing cruft.
  * These are symptoms of deeper factoring issues; the things they're controlling,
@@ -2018,8 +2015,6 @@ config_rlimit(
 				/* STDERR as well would be fine... */
 				msyslog(LOG_WARNING, "'rlimit memlock' specified but is not available on this system.");
 #endif /* RLIMIT_MEMLOCK */
-			} else {
-				do_memlock = false;
 			}
 			break;
 


=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -957,15 +957,6 @@ ntpdmain(
 	have_interface_option = (!listen_to_virtual_ips || explicit_interface);
 	intercept_getconfig(explicit_config);
 
-	if (do_memlock) {
-		/*
-		 * lock the process into memory
-		 */
-		if (!dumpopts &&
-		    0 != mlockall(MCL_CURRENT|MCL_FUTURE))
-			msyslog(LOG_ERR, "mlockall(): %m");
-	}
-
 	loop_config(LOOP_DRIFTINIT, 0);
 	report_event(EVNT_SYSRESTART, NULL, NULL);
 	initializing = false;



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/35da103d480fb7c45b846a0b20232987581ff25a
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160627/3842dc89/attachment.html>


More information about the vc mailing list