Bug 1493452

Summary: ntpd clears STA_UNSYNC on start
Product: Red Hat Enterprise Linux 7 Reporter: Miroslav Lichvar <mlichvar>
Component: ntpAssignee: Miroslav Lichvar <mlichvar>
Status: CLOSED ERRATA QA Contact: Andrej Dzilský <adzilsky>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: adzilsky, psklenar
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ntp-4.2.6p5-28.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 15:25:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Miroslav Lichvar 2017-09-20 08:52:21 UTC
Description of problem:
When ntpd starts, it immediately resets the kernel clock status to STA_PLL
without STA_UNSYNC, before the clock is actually synchronized. This enables synchronization of the RTC and misleads applications that use ntp_gettime()/adjtimex() to check when the clock is synchronized.

Version-Release number of selected component (if applicable):
ntp-4.2.6p5-27

How reproducible:
Always

Steps to Reproduce:
1. (re)start ntpd
2. run ntptime

Actual results:
ntp_gettime() returns code 0 (OK)
  time dd6ca9a3.d5c171d8  Wed, Sep 20 2017 10:47:31.834, (.834983622),
  maximum error 516 us, estimated error 16 us, TAI offset 0
ntp_adjtime() returns code 0 (OK)
  modes 0x0 (),
  offset 0.000 us, frequency 0.000 ppm, interval 1 s,
  maximum error 516 us, estimated error 16 us,
  status 0x2001 (PLL,NANO),
  time constant 3, precision 0.001 us, tolerance 500 ppm,


Expected results:
ntp_gettime() returns code 5 (ERROR)
  time dd6ca9c4.cb7142ec  Wed, Sep 20 2017 10:48:04.794, (.794697494),
  maximum error 16000000 us, estimated error 16000000 us, TAI offset 0
ntp_adjtime() returns code 5 (ERROR)
  modes 0x0 (),
  offset 0.000 us, frequency 0.000 ppm, interval 1 s,
  maximum error 16000000 us, estimated error 16000000 us,
  status 0x2041 (PLL,UNSYNC,NANO),
  time constant 3, precision 0.001 us, tolerance 500 ppm,


Additional info:

Upstream bug report: http://bugs.ntp.org/show_bug.cgi?id=3434

Comment 2 Andrej Dzilský 2017-10-16 15:47:41 UTC
ntp_adjtime() and ntp_gettime() now correctly return error codes.

Comment 5 errata-xmlrpc 2018-04-10 15:25:54 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0855