Subject: bin/11128: bind coredumps in 1.5_ALPHA
To: None <gnats-bugs@gnats.netbsd.org>
From: Ian Dall <ian@beware.dropbear.id.au>
List: netbsd-bugs
Date: 10/04/2000 07:47:18
>Number:         11128
>Category:       bin
>Synopsis:       The name daemon (bind) dumps core
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 04 07:47:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Ian Dall
>Release:        Sep 30, 2000
>Organization:
	
>Environment:
	
System: NetBSD gateway.beware.dropbear.id.au 1.5_ALPHA NetBSD 1.5_ALPHA (SIBYL) #0: Sun Aug 13 15:28:38 CST 2000 ian@sibyl.beware.dropbear.id.au:/usr3/netbsd-src/bsrc/sys/arch/pc532/compile/SIBYL pc532


>Description:
	
Running named on the pc532 platform core dumps almost immediately.
>How-To-Repeat:
	
Start named.
>Fix:
	
The problem seems to be due to writing beyond the end of the _res variable.
This happens in res_init.c:184, but is due to a problem in irs_data.c.

Bind uses its own version of resolv.h. The bind resolv.h defines
a bind___res_state structure and a bind__res instance of that structure.
__res_state and _res are cpp defines for convenience.

In irs_data.c there following appears:

 #undef _res 
 extern struct __res_state _res;

However, this undoes exactly the clash which was prevented by defining
_res to be bind__res. There may be other libc modules which have _res
defined. 

So, there is an external variable defined with different sizes in different
modules. I am not sure exactly what the linker does with this, but it doesn't
allocate enough space.

Removing the "#undef _res" fixes the problem (which begs the question of
why it was there in the first place). The extern statement is redundant
because it appears in resolv.h.
 
>Release-Note:
>Audit-Trail:
>Unformatted: