Bug 75558 - ntpd incorrectly requires an option for -x parameter
Summary: ntpd incorrectly requires an option for -x parameter
Alias: None
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: ntp   
(Show other bugs)
Version: 2.1
Hardware: i386 Linux
Target Milestone: ---
Assignee: Harald Hoyer
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2002-10-09 21:33 UTC by Need Real Name
Modified: 2007-11-30 22:06 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-02-14 21:02:09 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
fix ntpd -x skew bug (8.79 KB, patch)
2003-01-17 02:18 UTC, Yoshihide Sonoda
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2002:230 normal SHIPPED_LIVE New ntp package fixes a bug in parsing command line options 2002-10-10 04:00:00 UTC

Description Need Real Name 2002-10-09 21:33:43 UTC
ntpd should take a -x parameter w/out an option. The version distributed says -x
requires an argument incorrectly.

The bug came from the droproot patch to ntpd. The patch below is what needs to
change to get the -x to operate correctly. This is against the cmd_args.c file
in ntp/ntpd. The : following the option indicates the option requires an
argument. The droproot patch mistakenly added a : after the x when appending the
new options.

This problem exists in at least 2.1AS and 8.0. I was working with the 8.0 SRPM.
It should be very similar if not identical for the 2.1AS.

--- cmd_args.c.orig     2002-10-09 16:23:31.000000000 -0500
+++ cmd_args.c  2002-10-09 16:23:13.000000000 -0500
@@ -15,7 +15,7 @@
 extern char const *progname;
 int    listen_to_virtual_ips = 0;

-static const char *ntp_options = "aAbc:dD:f:gk:l:LmnN:p:P:qr:s:t:v:V:x:U:T:";
+static const char *ntp_options = "aAbc:dD:f:gk:l:LmnN:p:P:qr:s:t:v:V:xU:T:";

 /* Drop root patch */
 extern char *server_user;

Comment 1 Harald Hoyer 2002-10-10 10:34:49 UTC
good point... dooh..

Comment 2 Harald Hoyer 2002-10-10 14:33:06 UTC
there will be an erratum

Comment 3 Larry Woodman 2002-11-06 20:20:49 UTC
Is this available in an errata yet?

Larry Woodman

Comment 4 Harald Hoyer 2002-11-07 06:55:35 UTC
waiting in the QA queue... sorry

Comment 5 Jennifer E. Lamb 2002-11-18 16:56:45 UTC
Will the anticipated errata also keep ntp from slightly skewing the time when
using the -x option?  

The recommended -g parameter in addition to the step tickers file to correct the
drift has no effect.  The clock continues to slew out of sync.  Ntp produced the
same results.  Once ntp begins to slew the clock, it will never slew the time
back into sync and ntp continues to adjust the time futher out of sync. 
Regardless of the time source, ntp works correctly if it is set to step time. 
ntp fails miserably if it slews the time.

Also, ntp-4.1.1a-8.AS21.1 still has the same problem as the prior versions.

Comment 6 Joshua Jensen 2002-11-18 17:09:46 UTC
We are seeing many customers with this problem.  Please, please fix.

Comment 7 Harald Hoyer 2002-11-18 17:24:03 UTC
hmm, ntp uses adjtime, maybe the error is there??
Ulrich, Jakub? Any known issues? Also, should ntp use ntp_adjtime??

Comment 8 Ulrich Drepper 2002-11-18 19:14:11 UTC
All adjtime is doing is converting the time back and forth from and to struct
timeval format and then it calls ntp_adjtime.  ntp_adjtime takes the time as an
integer in 5sec.  It should make much of a difference to call ntp_adjtime directly.

Comment 9 Harald Hoyer 2002-11-19 15:51:03 UTC
you may want to try

This version uses ntp_adjtime vs. __adjtime in the old version.
Please give it the -x slew test..

Comment 10 Harald Hoyer 2002-11-19 15:51:45 UTC
that is... sorry

Comment 11 Harald Hoyer 2002-11-20 16:54:27 UTC
is with minimal changes... erratum is in the queue

Comment 12 Yoshihide Sonoda 2003-01-17 02:18:59 UTC
Created attachment 89416 [details]
fix ntpd -x skew bug

This patch is to fix ntpd -x skewing bug.
Apply to "/usr/src/linux-2.4/kernel/time.c".

Comment 13 Yoshihide Sonoda 2003-01-17 02:22:23 UTC
This problem causes kernel bug.
The do_adjtimex() function in /usr/src/linux-2.4/kernel/time.c is wrong
implementation. When the time difference of a server and a client becames
0.512 or more, ntpd stop skewing.
Since a clock is set by "step" with a difference for 0.128 seconds while not
using -x options, this is happend only while using -x option.

This implementation is very strange in comparison with other OS's,
such as FreeBSD, Solaris and HP-UX.
Then, I corrected Linux kernel to reference for the source code of FreeBSD.
(see http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/kern_ntptime.c?

Try my patch.

Comment 14 John Flanagan 2003-02-14 21:02:09 UTC
An errata has been issued which should help the problem described in this bug report. 
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen 
this bug report if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.