Regression in libbind's resolver initialization

Andris Kalnozols andris at hpl.hp.com
Fri Jun 29 21:38:09 UTC 2007


> 
> Index: resolv/res_init.c
> ===================================================================
> RCS file: /proj/cvs/prod/bind9/lib/bind/resolv/res_init.c,v
> retrieving revision 1.22
> diff -u -r1.22 res_init.c
> --- resolv/res_init.c	11 Dec 2006 04:35:39 -0000	1.22
> +++ resolv/res_init.c	29 Jun 2007 13:06:19 -0000
> @@ -168,7 +168,7 @@
>  	union res_sockaddr_union u[2];
>  	int maxns = MAXNS;
>  
> -	h_errno = 0;
> +	RES_SET_H_ERRNO(statp, 0);
>  	if (statp->_u._ext.ext != NULL)
>  		res_ndestroy(statp);
>  
> @@ -231,7 +231,7 @@
>  		 * to check our return code wont be able to make
>  		 * queries anyhow.
>  		 */
> -		h_errno = statp->res_h_errno = NETDB_INTERNAL;
> +		RES_SET_H_ERRNO(statp, NETDB_INTERNAL);
>  		maxns = 0;
>  	}
>  #ifdef RESOLVSORT
> @@ -498,7 +498,7 @@
>  	if ((cp = getenv("RES_OPTIONS")) != NULL)
>  		res_setoptions(statp, cp, "env");
>  	statp->options |= RES_INIT;
> -	return (h_errno);
> +	return (statp->res_h_errno);
>  }
>  
>  static void
> -- 

As long as we're dealing with changes to res_init.c, I thought I'd
jump in and present this failure which the runtime checker blames
on the same code (even after applying the above patch):

  cc -g +O0 +check=all -DSnative -DHAVE_BINDLIB -D_REENTRANT \
     -D_XOPEN_SOURCE_EXTENDED -o dnscap dnscap.c \
     -I/usr/local/include -I/usr/local/bind/include \
     -L/usr/local/src/libpcap/0.9.5 \
     -L/usr/local/src/bind/9.5.0a5/src/lib/bind/.libs \
     -L/usr/local/lib/hpux32 \
     -l:libpcap.a -l:libbind.a -lasprintf -lstd_v2 -lCsup -lunwind
uucp-gw1# ./dnscap -d1g -i lan1
dnscap: version V1.0-RC4 (May 2007)
dnscap: msg Q.IR., hide .., t 86400, c 1000000000
dnscap: "udp port 53 and udp[10] & 0x7a = 0 and udp[11] & 0xf = 0"
;@ June 18:55:04.950204 - 48 octets via lan1 (msg #1)
;: [68.6.19.39]:32769 -> [204.123.2.18]:53
Runtime Error: out of bounds in file res_init.c at line 674 at index 3

(0)  0x00000000043c1de0  _rtc_raise_fault + 0x150 at rtc_utils.c:60 [./dnscap]
(1)  0x00000000043c23e0  _rtc_check_bounds_with_index + 0x210 at rtc_utils.c:127 [./dnscap]
(2)  0x00000000041d8780  __res_nclose + 0x5e0 at res_init.c:674 [./dnscap]
(3)  0x00000000041d3180  __res_ndestroy + 0x70 at res_init.c:684 [./dnscap]
(4)  0x00000000041caa10  __res_vinit + 0x1140 at res_init.c:175 [./dnscap]
(5)  0x00000000041aa930  __res_init + 0x230 at res_data.c:121 [./dnscap]
(6)  0x00000000041aabf0  __fp_nquery + 0xd0 at res_data.c:136 [./dnscap]
(7)  0x000000000404d770  live_packet + 0x99f0 at dnscap.c:1247 [./dnscap]
(8)  0x0000000004051620  pcap_read_dlpi + 0x19e0 at ./pcap-dlpi.c:361 [./dnscap]
(9)  0x00000000040624d0  pcap_dispatch + 0x170 at ./pcap.c:77 [./dnscap]
(10) 0x000000000403e960  poll_pcaps + 0xb00 at dnscap.c:847 [./dnscap]
(11) 0x0000000004034970  main + 0x2d0 at dnscap.c:282 [./dnscap]
(12) 0x60000000c004b550  main_opd_entry + 0x50 [/usr/lib/hpux32/dld.so]
Abort(coredump)
uucp-gw1# gdb dnscap core
HP gdb 5.4.0 for HP Itanium (32 or 64 bit) and target HP-UX 11.2x.
Copyright 1986 - 2001 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 5.4.0 (based on GDB) is covered by the
GNU General Public License. Type "show copying" to see the conditions to
change it and/or distribute copies. Type "show warranty" for warranty/support.
..
Core was generated by `dnscap'.
Program terminated with signal 6, Aborted.

#0  0x60000000c0360510:0 in kill+0x30 () from /usr/lib/hpux32/libc.so.1
(gdb) bt
#0  0x60000000c0360510:0 in kill+0x30 () from /usr/lib/hpux32/libc.so.1
#1  0x60000000c0256d50:0 in raise+0x30 () from /usr/lib/hpux32/libc.so.1
#2  0x60000000c031a250:0 in abort+0x190 () from /usr/lib/hpux32/libc.so.1
#3  0x43c1ef0:0 in _rtc_raise_fault () at rtc_utils.c:62
#4  0x43c23e0:0 in _rtc_check_bounds_with_index () at rtc_utils.c:127
#5  0x41d8780:0 in __res_nclose (statp=0x7ef7d040) at res_init.c:674
#6  0x41d3180:0 in __res_ndestroy (statp=0x7ef7d040) at res_init.c:683
#7  0x41caa10:0 in __res_vinit (statp=0x7ef7d040, preinit=1) at res_init.c:173
#8  0x41aa930:0 in __res_init () at res_data.c:121
#9  0x41aabf0:0 in __fp_nquery (msg=0x7ffaea9e "\261\267", len=48,
    file=0x7ef82c30) at res_data.c:136
#10 0x404d770:0 in live_packet (user=0x4003d6b0 "", hdr=0x7ffff1b0,
    opkt=0x404d1932 "") at dnscap.c:1247
#11 0x4051620:0 in pcap_read_dlpi (p=0x404c5da0, cnt=-1,
    callback=0x4033ad0 <.opd+0x20>, user=0x4003d6b0 "") at ./pcap-dlpi.c:361
#12 0x40624d0:0 in pcap_dispatch (p=0x404c5da0, cnt=-1,
    callback=0x4033ad0 <.opd+0x20>, user=0x4003d6b0 "") at ./pcap.c:77
#13 0x403e960:0 in poll_pcaps () at dnscap.c:847
#14 0x4034970:0 in main (argc=4, argv=0x7ffff754) at dnscap.c:282
(gdb)


BTW, this problem only shows up on the ia64; things work fine on PA-RISC.

------
Andris Kalnozols



More information about the bind-workers mailing list