Port-sparc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ntpd wedged by libc?



On Mar 10,  2:56pm, agcarver+netbsd%acarver.net@localhost (AGC) wrote:
-- Subject: Re: ntpd wedged by libc?

| On 3/10/2012 13:54, AGC wrote:
| > On 3/10/2012 12:28, Christos Zoulas wrote:
| >> On Mar 10, 11:48am, agcarver+netbsd%acarver.net@localhost (AGC) wrote:
| >> -- Subject: Re: ntpd wedged by libc?
| >>
| >> | On 3/10/2012 00:31, Dave Hart wrote:
| >> |> On Sat, Mar 10, 2012 at 07:05, 
AGC<agcarver+netbsd%acarver.net@localhost> wrote:
| >> |>> snprintf.c:1108: error: expected '=', ',', ';', 'asm' or
| >> '__attribute__'
| >> |>> before '*' token
| >> |>> snprintf.c:1108: error: 'puch' undeclared (first use in this
| >> function)
| >> |>
| >> |> Change line 1108 to:
| >> |>
| >> |> const unsigned char *puch;
| >> |
| >> | Made it a little farther this time but still failed:
| >> |
| >> | ../libntp/libntp.a(snprintf.o): In function `fmtflt':
| >> | /usr/src/ntp-dev-4.2.7p259/libntp/snprintf.c:1152: undefined reference
| >> | to `dtoa'
| >> | /usr/src/ntp-dev-4.2.7p259/libntp/snprintf.c:1152: undefined reference
| >> | to `freedtoa'
| >> | *** Error code 1
| >> -- End of excerpt from AGC
| >>
| >> Try __dtoa and __freedtoa
| >
| > That fixed it. printf_dtoa.log has been generated so I'll keep an eye on
| > it and see what happens.
| >
| 
| Well, that didn't take long:
| 
| 
| (gdb) bt
| #0  0x103c3430 in .umul () from /usr/lib/libc.so.12
| #1  0x103b58fc in __pow5mult_D2A () from /usr/lib/libc.so.12
| #2  0x103b5adc in __muldi3 () from /usr/lib/libc.so.12
| #3  0x103b5494 in __mult_D2A () from /usr/lib/libc.so.12
| #4  0x103b5728 in __pow5mult_D2A () from /usr/lib/libc.so.12
| #5  0x103a8138 in __dtoa () from /usr/lib/libc.so.12
| #6  0x00067a04 in fmtflt (str=0xefffe450 " 109.76 97.75 98.77 97.79 
| 103.00 97.72 98.15", len=0xefffe364,
|      size=184, fvalue=-4.2612301185727119, width=0, precision=2, 
| flags=0, overflow=0xefffe360) at snprintf.c:1152
| #7  0x0006898c in rpl_vsnprintf (str=0xefffe450 " 109.76 97.75 98.77 
| 97.79 103.00 97.72 98.15", size=184,
|      format=<value optimized out>, args=0xefffe438) at snprintf.c:851
| #8  0x00068de4 in rpl_snprintf (str=0xefffe450 " 109.76 97.75 98.77 
| 97.79 103.00 97.72 98.15", size=184,
|      format=0x8a260 " %.2f") at snprintf.c:1583
| #9  0x000252a0 in ctl_putarray (tag=<value optimized out>, arr=0xb3128, 
| start=2) at ntp_control.c:1673
| #10 0x000262e8 in ctl_putpeer (id=30, p=0xb2fa0) at ntp_control.c:2506
| #11 0x0002b068 in read_variables (rbufp=0x10528000, restrict_mask=0) at 
| ntp_control.c:3012
| #12 0x00028a44 in process_control (rbufp=0x10528000, restrict_mask=0) at 
| ntp_control.c:1123
| #13 0x00038744 in receive (rbufp=0x10528000) at ntp_proto.c:432
| #14 0x00023410 in ntpdmain (argc=0, argv=0xefffebdc) at ntpd.c:1069
| #15 0x000138a4 in ___start ()
| #16 0x000137dc in _start ()
| 
| The printf_dota.log file is about 2.2 MB located here:
| 
| http://acarver.net/ntpd/printf_dtoa.log

Hmm, does not seem to leak for me. Here's how I tested it:


#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/endian.h>

int
main(int argc, char *argv[])
{
        union {
                unsigned long long ull;
                double d;
        } u;
        char line[128];

        FILE *fp = fopen("/dev/null", "w");

        while (fgets(line, sizeof(line), stdin)) {
                char *p = strchr(line, '\n');
                if (p)
                        *p = '\0';
                errno = 0;
                u.ull = be64toh(strtoull(line, &p, 16));
                if (errno)
                        err(1, "line=%s", line);
                else if (p == line || *p)
                        errx(1, "line=%s", line);
                fprintf(fp, "%g", u.d);
        }
        fclose(fp);
        return 0;
}



Home | Main Index | Thread Index | Old Index