[Git][NTPsec/ntpsec][master] 2 commits: Add chrony-style unlimited memlock to reduce latency.
Eric S. Raymond
gitlab at mg.gitlab.com
Sat Jul 2 20:50:46 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
fe05e182 by Eric S. Raymond at 2016-07-02T16:50:35-04:00
Add chrony-style unlimited memlock to reduce latency.
- - - - -
ffd0a125 by Eric S. Raymond at 2016-07-02T16:50:35-04:00
Minor update of new features and requirements.
- - - - -
2 changed files:
- docs/index.txt
- ntpd/ntpd.c
Changes:
=====================================
docs/index.txt
=====================================
--- a/docs/index.txt
+++ b/docs/index.txt
@@ -77,7 +77,8 @@ We retain, however, almost full compatibility and interoperation with
NTP Classic. The qualification "almost" is required because we do not
support the Autokey (RFC5906) public-key encryption scheme. It had
interoperability and exploitable vulnerability issues too severe to
-be patched.
+be patched. We are participating in an IETF effort to develop better
+security features.
This project began as an effort to address serious security issues
with NTP Classic, and we intend to keep a particularly strong focus on
@@ -107,6 +108,9 @@ few will be user-visible.
saveconfig command in ntpq, the --saveconfigquit option of ntpd, and
the implementation of related config declarations in ntp.conf.
+* The code has been systematically hardened, with with unsafe string
+ copy and formatting functions replaced by safe (bounded) ones.
+
* In toto, around 60% of the NTP Classic code has been outright
removed, with less than 5% new code added. This is a dramatic
reduction in attack surface.
@@ -168,7 +172,9 @@ few will be user-visible.
{project-shortname} supports all operating systems conforming to
POSIX.1-2001 and ISO/IEC 9899:1999 (aka C99). Primary platforms
include Linux and the *BSD family; any reasonably modern proprietary
-Unix will also serve
+Unix will also serve. The OS must have either a Linux-like
+adjtimex(2) call or a BSD-like pair of ntp_gettime(2)/ntp_adjtime(2)
+calls.
If you have a requirement for time service on an OS we don't support,
and its API is reasonably close to our POSIX/C99 conformance baseline,
=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -941,6 +941,22 @@ ntpdmain(
have_interface_option = (!listen_to_virtual_ips || explicit_interface);
intercept_getconfig(explicit_config);
+ /*
+ * ntpd's working set is never going to be larege relative to memory
+ * availability on modern machines. Do what chrony does and indulge it;
+ * we get some latency improvement that way.
+ */
+ {
+ struct rlimit rlim;
+ rlim.rlim_max = rlim.rlim_cur = RLIM_INFINITY;
+ if (setrlimit(RLIMIT_MEMLOCK, &rlim) < 0)
+ msyslog(LOG_WARNING, "setrlimit() failed: not locking into RAM");
+ else if (mlockall(MCL_CURRENT|MCL_FUTURE) < 0)
+ msyslog(LOG_WARNING, "mlockall() failed: not locking into RAM");
+ else
+ msyslog(LOG_INFO, "successfully locked into RAM");
+ }
+
loop_config(LOOP_DRIFTINIT, 0);
report_event(EVNT_SYSRESTART, NULL, NULL);
initializing = false;
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/1cb07cd8546bc30db54021e4dc15a6ceb54c2eaf...ffd0a125a6e5ec22870a69a320e7575bd6b7a7a0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160702/2c5084f4/attachment.html>
More information about the vc
mailing list