Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Nov 2006 11:14:19 +0100
From:      "Ulrich Spoerlein" <uspoerlein@gmail.com>
To:        stable@freebsd.org, kazakov@gmail.com
Subject:   ntpd vs nss_ldap: Crashing in getaddrinfo
Message-ID:  <7ad7ddd90611150214q1ff88220g5105ab513908eeb3@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,

I needed to test the ntpd from ports (net/ntp, net/ntp-devel,
net/ntp-stable), but they always crashed with a SIGBUS error.
Investigation lead to nss_ldap being the culprit.

With nss_ldap installed and NO keyword "ldap" in /etc/nsswitch.conf,
ntpd will run fine. If you either add "ldap" to passwd or group or
both, ntpd will crash calling gethostaddr (even though LDAP is only
used for passwd/group)

/etc/nsswitch.conf:
group: files ldap
hosts: files dns
networks: files
passwd: files ldap
shells: files


root@build:/usr/ports/net/ntp-stable/work/ntp-4.2.2p4-RC4/ntpd# gdb ./ntpd
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...
(gdb) r -d
Starting program: /usr/ports/net/ntp-stable/work/ntp-4.2.2p4-RC4/ntpd/ntpd -d
ntpd 4.2.2p4-RC4@1.1585-o Wed Nov 15 09:56:13 UTC 2006 (1)
addto_syslog: precision = 1.117 usec
create_sockets(123)
addto_syslog: no IPv6 interfaces found
addto_syslog: ntp_io: estimated max descriptors: 10951, initial socket
boundary: 20
bind() fd 20, family 2, port 123, addr 0.0.0.0, flags=9
Added addr 0.0.0.0 to list of addresses
addto_syslog: Listening on interface wildcard, 0.0.0.0#123 Disabled
bind() fd 21, family 2, port 123, addr 16.30.58.127, flags=25
Added addr 16.30.58.127 to list of addresses
addto_syslog: Listening on interface xl0, 16.30.58.127#123 Enabled
bind() fd 22, family 2, port 123, addr 127.0.0.1, flags=21
Added addr 127.0.0.1 to list of addresses
addto_syslog: Listening on interface lo0, 127.0.0.1#123 Enabled
init_io: maxactivefd 22
local_clock: time 0 base 0.000000 offset 0.000000 freq 0.000 state 0

Program received signal SIGBUS, Bus error.
0x280a98c8 in memset () from /libexec/ld-elf.so.1
(gdb) bt
#0  0x280a98c8 in memset () from /libexec/ld-elf.so.1
#1  0x280c2100 in ?? ()
#2  0x2809f039 in map_object () from /libexec/ld-elf.so.1
#3  0x2809c115 in elf_hash () from /libexec/ld-elf.so.1
#4  0x2809c21c in elf_hash () from /libexec/ld-elf.so.1
#5  0x2809de8c in dlopen () from /libexec/ld-elf.so.1
#6  0x2828140c in _nsdbtaddsrc () from /lib/libc.so.6
#7  0x2827cb92 in ___toupper () from /lib/libc.so.6
#8  0x2827d1b4 in _nsyyparse () from /lib/libc.so.6
#9  0x2828179e in nsdispatch () from /lib/libc.so.6
#10 0x28271776 in getaddrinfo () from /lib/libc.so.6
#11 0x0804bfee in getnetnum (num=0xbfbfe537 "ntp0.XXXX.com",
addr=0xbfbfe9d0, complain=0, a_type=t_UNK) at ntp_config.c:2222
#12 0x0804cb5f in getconfig (argc=2, argv=0xbfbfebcc) at ntp_config.c:652
#13 0x0805246e in ntpdmain (argc=2, argv=0xbfbfebcc) at ntpd.c:744
#14 0x080527bb in main (argc=2, argv=0xbfbfebcc) at ntpd.c:274
(gdb) f 11
#11 0x0804bfee in getnetnum (num=0xbfbfe537 "ntp0.XXXX.com",
addr=0xbfbfe9d0, complain=0, a_type=t_UNK) at ntp_config.c:2222
2222            retval = getaddrinfo(num, "ntp", &hints, &ptr);
(gdb) l
2217            hints.ai_socktype = SOCK_DGRAM;
2218    #ifdef DEBUG
2219                    if (debug > 3)
2220                            printf("getaddrinfo %s\n", num);
2221    #endif
2222            retval = getaddrinfo(num, "ntp", &hints, &ptr);
2223            if (retval != 0 ||
2224               (ptr->ai_family == AF_INET6 && isc_net_probeipv6()
!= ISC_R_SUCCESS)) {
2225                    if (complain)
2226                            msyslog(LOG_ERR,
(gdb)

What's happening?

Uli



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7ad7ddd90611150214q1ff88220g5105ab513908eeb3>