NetBSD Problem Report #41144

From martin@duskware.de  Sun Apr  5 08:49:32 2009
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 9151363B8A5
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  5 Apr 2009 08:49:32 +0000 (UTC)
Message-Id: <20090405084921.DFBA733AAE@mail.duskware.de>
Date: Sun,  5 Apr 2009 10:49:16 +0200 (CEST)
From: martin
Reply-To: martin
To: gnats-bugs@gnats.NetBSD.org
Subject: ntpd dies when syncing
X-Send-Pr-Version: 3.95

>Number:         41144
>Category:       port-vax
>Synopsis:       ntpd dies when syncing
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-vax-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 05 08:50:00 +0000 2009
>Closed-Date:    Mon Apr 06 16:06:21 +0000 2009
>Last-Modified:  Mon Apr 06 16:06:21 +0000 2009
>Originator:     Martin Husemann
>Release:        NetBSD 5.99.10
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD dead-to-the-world.duskware.de 5.99.10 NetBSD 5.99.10 (DEAD) #2: Sat Apr 4 20:45:50 CEST 2009 martin@night-porter.duskware.de:/usr/src/sys/arch/vax/compile/DEAD vax
Architecture: vax
Machine: vax
>Description:

Running ntpd works for a bit, but as soon as it syncs to a server, it dies.

Core was generated by `ntpd'.
Program terminated with signal 4, Illegal instruction.
#0  0x7f7b5efd in snprintb (2147475768, 1024, 401116, 8256, 0)
   from /usr/lib/libutil.so.7
(gdb) bt
#0  0x7f7b5efd in snprintb (2147475768, 1024, 401116, 8256, 0)
   from /usr/lib/libutil.so.7
#1  0x7f7e292e in _rtld_bind_start (2147475768, 1024, 401116, 8256, 0)
   from /usr/libexec/ld.elf_so
#2  0x00027306 in sync_status (what=0x6b2c4 "status", 
    status=8256, 438980, 8256) at /usr/src/dist/ntp/ntpd/ntp_loopfilter.c:192
[..]
(gdb) list
187     static void
188     sync_status(const char *what, int status)
189     {
190             char buf[1024];
191     #ifdef STA_FMT
192             snprintb(buf, sizeof(buf), STA_FMT, ntv.status);
193     #else
194             snprintf(buf, sizeof(buf), "%04x, status);
195     #endif
196             NLOG(NLOG_SYNCEVENT | NLOG_SYSEVENT)


>How-To-Repeat:
Use this small test program:

--8<--
#include <stdio.h>
#include <util.h>
#include <sys/timex.h>

#define TEST_VALUE 8256

int main(int argc, char **argv)
{
        char buf[1024];

        snprintb(buf, sizeof(buf), STA_FMT, TEST_VALUE);
        printf("string: %s\n", buf);
        return 0;
}
-->8--
cc -static -g -O0 -Wall test.c -lutil
and just run it in gdb...

>Fix:
no idea, don't speak vax asm

>Release-Note:

>Audit-Trail:
From: "Michael L. Hitch" <mhitch@lightning.msu.montana.edu>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-vax/41144: ntpd dies when syncing
Date: Sun, 5 Apr 2009 13:13:34 -0600 (MDT)

 On Sun, 5 Apr 2009, martin@NetBSD.org wrote:

 >> Fix:
 > no idea, don't speak vax asm

    The vax was trying to extract a bit out of status that was out of range,
 and generated an instruction fault.

    The problem is in the definition of STA_FMT, specifically:
 b\xcCLOCKERR\0\

    The \xcC was being converted to 0xcc as the bit position, and leaving 
 LOCKERR as the text string.

 --
 Michael L. Hitch			mhitch@montana.edu
 Computer Consultant
 Information Technology Center
 Montana State University	Bozeman, MT	USA

State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Mon, 06 Apr 2009 16:06:21 +0000
State-Changed-Why:
Christos fixed it in rev 1.18 of src/sys/sys/timex.h
Wasn't vax specific at all.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.