Package: ntp-simple
Version: 1:4.2.0a+stable-8
Severity: minor

[[ SOLVED: still submitted in case it helps anyone else.
   The problem was a combination of a 127.127.1.0 refclock and
   the loopback interface not being configured due to not having
   uncommented the line in /etc/network/interfaces.  It might be
   nice to make the failure less mysterious, though.  To reproduce,
   configuyre ntp.conf with a 127.127.1.0 fallback server, "ifdown lo",
   and start ntpd. ]]

It dies almost immediately on startup.  An strace ends with

2452  capset(0x19980330, 0, {CAP_SETGID|CAP_SETUID|CAP_SYS_TIME, 
CAP_SETGID|CAP_SETUID|CAP_SYS_TIME, }) = 0
2452  prctl(0x8, 0x1, 0, 0, 0)          = 0
2452  setgid32(110)                     = 0
2452  setresgid32(-1, 110, -1)          = 0
2452  setuid32(110)                     = 0
2452  setresuid32(-1, 110, -1)          = 0
2452  capset(0x19980330, 0, {CAP_SYS_TIME, CAP_SYS_TIME, }) = 0
2452  select(6, [4 5], NULL, NULL, NULL) = ? ERESTARTNOHAND (To be restarted)
2452  --- SIGALRM (Alarm clock) @ 0 (0) ---
2452  sigreturn()                       = ? (mask now [])
2452  gettimeofday({1115319136, 380922}, NULL) = 0
2452  sendto(5, 
"\343\0\6\361\0\0\0\0\0\0\0\0INIT\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\306$\351\340a\204\32\254",
 48, 0, {sa_family=AF_INET, sin_port=htons(123), 
sin_addr=inet_addr("193.201.200.74")}, 16) = 48
2452  gettimeofday({1115319136, 381080}, NULL) = 0
2452  select(6, [4 5], NULL, NULL, NULL) = 1 (in [5])
2452  gettimeofday({1115319136, 486435}, NULL) = 0
2452  select(6, [4 5], NULL, NULL, {0, 0}) = 1 (in [5], left {0, 0})
2452  recvfrom(5, "$\3\6\354\0\0\3\210\0\0\22|[EMAIL PROTECTED]", 1092, 0, 
{sa_family=AF_INET, sin_port=htons(123), sin_addr=inet_addr("193.201.200.74")}, 
[16]) = 48
2452  select(6, [5], NULL, NULL, {0, 0}) = 0 (Timeout)
2452  gettimeofday({1115319136, 486661}, NULL) = 0
2452  gettimeofday({1115319136, 486699}, NULL) = 0
2452  gettimeofday({1115319136, 486756}, NULL) = 0
2452  time(NULL)                        = 1115319136
2452  time(NULL)                        = 1115319136
2452  stat64("/var/log/ntpstats/peerstats", {st_mode=S_IFREG|0644, st_size=247, 
...}) = 0
2452  unlink("/var/log/ntpstats/peerstats") = 0
2452  open("/var/log/ntpstats/peerstats.20050505", O_WRONLY|O_APPEND|O_CREAT, 
0666) = 6
2452  fstat64(6, {st_mode=S_IFREG|0644, st_size=247, ...}) = 0
2452  mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0xb7ffe000
2452  fstat64(6, {st_mode=S_IFREG|0644, st_size=247, ...}) = 0
2452  _llseek(6, 247, [247], SEEK_SET)  = 0
2452  link("/var/log/ntpstats/peerstats.20050505", 
"/var/log/ntpstats/peerstats") = 0
2452  write(6, "53495 67936.487 193.201.200.74 9014 0.011817000 0.105424000 
7.937516527 0.000030"..., 84) = 84
2452  select(6, [4 5], NULL, NULL, NULL) = ? ERESTARTNOHAND (To be restarted)
2452  --- SIGALRM (Alarm clock) @ 0 (0) ---
2452  sigreturn()                       = ? (mask now [])
2452  gettimeofday({1115319137, 381707}, NULL) = 0
2452  gettimeofday({1115319137, 381737}, NULL) = 0
2452  gettimeofday({1115319137, 381771}, NULL) = 0
2452  --- SIGSEGV (Segmentation fault) @ 0 (0) ---

That's the first NTP packet received; all previous recvfrom() calls are DNS.

Running it under gdb
(build-simple/ntpd/ntpd -n -p /var/run/ntpd.pid -u 110:110)
dies in
#0  0x08062af3 in peer_unfit (peer=0x807b844) at ../../ntpd/ntp_proto.c:2960
#1  0x08061096 in clock_select () at ../../ntpd/ntp_proto.c:1885
#2  0x08060dee in clock_filter (peer=0x807b844, sample_offset=0, 
    sample_delay=0, sample_disp=2) at ../../ntpd/ntp_proto.c:1793
#3  0x08063c8a in refclock_receive (peer=0x807b844)
    at ../../ntpd/ntp_refclock.c:581
#4  0x0806aa33 in local_poll (unit=0, peer=0x807b844)
    at ../../ntpd/refclock_local.c:259
#5  0x080634fa in refclock_transmit (peer=0x807b844)
    at ../../ntpd/ntp_refclock.c:344
#6  0x080697b5 in timer () at ../../ntpd/ntp_timer.c:287
#7  0x08051bb7 in ntpdmain (argc=0, argv=0xbffffae0) at ../../ntpd/ntpd.c:1101
#8  0x0805177b in main (argc=98175, argv=0x17f7f) at ../../ntpd/ntpd.c:241

2955    static int                      /* 0 if no, 1 if yes */
2956    peer_unfit(
2957            struct peer *peer       /* peer structure pointer */
2958            )
2959    {
2960            return (!peer->reach ||         /* unreachable */
2961                (peer->stratum > 1 && peer->dstadr->addr_refid ==
2962                peer->refid) ||             /* timing loop */
2963                peer->leap == LEAP_NOTINSYNC || /* never synchronized */
2964                peer->stratum >= STRATUM_UNSPEC || /* no source */
2965                peer->flags & FLAG_NOSELECT); /* unselected */
2966    }

The sequence of events is:
peer->reach == 1
peer->stratum == 13
peer->dstadr == NULL -> SIGSEGV

The full structure (for the local system clock server, 127.127.1.0) is:

(gdb) p *peer
$7 = {next = 0x0, ass_next = 0x0, srcadr = {ss_family = 2, __ss_align = 98175, 
    __ss_padding = '\0' <repeats 119 times>}, dstadr = 0x0, associd = 55373, 
  version = 4 '\004', hmode = 3 '\003', hpoll = 6 '\006', minpoll = 6 '\006', 
  maxpoll = 10 '\n', flags = 33, cast_flags = 1 '\001', flash = 0, 
  last_event = 4 '\004', num_events = 1 '\001', ttl = 0 '\0', 
  procptr = 0x80c2f30, refclktype = 1 '\001', refclkunit = 0 '\0', 
  sstclktype = 0 '\0', leap = 0 '\0', pmode = 4 '\004', stratum = 13 '\r', 
  precision = -20 'ì', ppoll = 10 '\n', refid = 98175, reftime = {Ul_i = {
      Xl_ui = 3324308812, Xl_i = -970658484}, Ul_f = {Xl_uf = 4137277571, 
      Xl_f = -157689725}}, keyid = 0, assoc = 0, crypto = 0, pkey = 0x0, 
  first = 0, last = 0, digest = 0x0, subject = 0x0, issuer = 0x0, pkeyid = 0, 
  pcookie = 0, ident_pkey = 0x0, fstamp = 0, iffval = 0x0, grpkey = 0x0, 
  cookval = {tstamp = 0, fstamp = 0, vallen = 0, ptr = 0x0, siglen = 0, 
    sig = 0x0}, recval = {tstamp = 0, fstamp = 0, vallen = 0, ptr = 0x0, 
    siglen = 0, sig = 0x0}, tai_leap = {tstamp = 0, fstamp = 0, vallen = 0, 
    ptr = 0x0, siglen = 0, sig = 0x0}, cmmd = 0x0, keylist = 0x0, 
  keynumber = 0, encrypt = {tstamp = 0, fstamp = 0, vallen = 0, ptr = 0x0, 
    siglen = 0, sig = 0x0}, sndval = {tstamp = 0, fstamp = 0, vallen = 0, 
    ptr = 0x0, siglen = 0, sig = 0x0}, status = 0 '\0', reach = 1 '\001', 
  epoch = 0, burst = 0, filter_nextpt = 1, filter_delay = {0, 0, 0, 0, 0, 0, 
    0, 0}, filter_offset = {0, 0, 0, 0, 0, 0, 0, 0}, filter_disp = {
    9.5367431640625e-07, 16, 16, 16, 16, 16, 16, 16}, filter_epoch = {0, 2, 0, 
    0, 0, 0, 0, 0}, filter_order = "\000\a\006\005\004\003\002\001", org = {
    Ul_i = {Xl_ui = 3324308812, Xl_i = -970658484}, Ul_f = {
      Xl_uf = 4137277571, Xl_f = -157689725}}, rec = {Ul_i = {
      Xl_ui = 3324308812, Xl_i = -970658484}, Ul_f = {Xl_uf = 4137341996, 
      Xl_f = -157625300}}, xmt = {Ul_i = {Xl_ui = 3324308812, 
      Xl_i = -970658484}, Ul_f = {Xl_uf = 4137268981, Xl_f = -157698315}}, 
  offset = 0, delay = 0, jitter = 9.5367431640625e-07, 
  disp = 7.9375004768371582, estbdelay = 0.0040000000000000001, hyst = 0, 
  rootdelay = 0, rootdispersion = 0.01, update = 2, unreach = 0, outdate = 2, 
  nextdate = 2, nextaction = 0, action = 0, timereset = 0, timereceived = 2, 
  timereachable = 0, sent = 1, received = 1, processed = 0, badauth = 0, 
  bogusorg = 0, oldpkt = 0, seldisptoolarge = 0, selbroken = 0, rank = 0}

/etc/ntp.conf is the unmodified .dpkg-dist.

Kernel is stock 2.6.11.8, uniprocessor, desktop configuration (preempt, etc.).
system is up-to-date unstable (sid).
Tried with and without libc6-i686; no change.

        libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x423c2000)
        libcrypto.so.0.9.7 => /usr/lib/i686/cmov/libcrypto.so.0.9.7 (0x43199000)
        libcap.so.1 => /lib/libcap.so.1 (0x423eb000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x4228b000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x469d1000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x423e6000)

libc6 Version: 2.3.2.ds1-21
libc6-i686 Version: 2.3.2.ds1-21
libcap1 Version: 1:1.10-14


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to