NetBSD Problem Report #10047
Received: (qmail 17564 invoked from network); 5 May 2000 00:18:33 -0000
Message-Id: <200005050018.MAA10531@city-art.mcs.vuw.ac.nz>
Date: Fri, 5 May 2000 12:18:30 +1200 (NZST)
From: Mark Davies <mark@MCS.VUW.AC.NZ>
Reply-To: mark@MCS.VUW.AC.NZ
To: gnats-bugs@gnats.netbsd.org
Subject: amd with hesiod maps sometimes crashing
X-Send-Pr-Version: 3.95
>Number: 10047
>Category: bin
>Synopsis: amd with hesiod maps sometimes crashing
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: dogcow
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri May 05 00:19:01 +0000 2000
>Closed-Date: Fri Apr 04 21:53:40 +0000 2003
>Last-Modified: Fri Apr 04 21:53:40 +0000 2003
>Originator: Mark Davies
>Release: 2000/04/09
>Organization:
Dept. of Comp. Sci., Victoria Uni. of Wellington, New Zealand.
>Environment:
System: NetBSD city-art.mcs.vuw.ac.nz 1.4X NetBSD 1.4X (MCS_WORKSTATION) #0: Sun Apr 9 10:29:55 NZST 2000 mark@turakirae.mcs.vuw.ac.nz:/src/build/src/sys/arch/i386/compile/MCS_WORKSTATION i386
>Description:
amd will sometimes coredump when using hesiod maps when looking up
keys that start with a "."
Below is what I sent to the amd and hesiod developers about a year ago when I
first discovered this problem on Digital UNIX. The versions in NetBSD still
have the problem.
Hi,
This is actually a hesiod bug but it makes amd core dump.
a call to hesiod_resolve in the "new style hesiod" (version 3.0.2 at least)
with a key of the form ".directory.others.u", or any key with a leading "."
returns NULL but _errno has value 0_.
The effect of this on amd is that under these circumstances hesiod_search will
not set pval but mapc_meta_search which calls it will assume that it has (due
to the lack of an positive errno) and will try to dereference it.
I started seeing this happen a lot once we started running KDE which tends to
want to look for the file ".directory" in every directory the file manager
looks at.
My workaround is below:
*** info_hesiod.c~ Thu Feb 4 20:24:15 1999
--- info_hesiod.c Wed Mar 10 13:30:24 1999
***************
*** 107,112 ****
--- 107,115 ----
(unsigned long) m, map, key, (unsigned long) pval, (unsigned long) tp);
#endif /* DEBUG */
+ if (key[0] == '.')
+ return ENOENT;
+
sprintf(hes_key, "%s.%s", key, map + HES_PREFLEN);
/*
On the assumption that a key with a leading "." is never valid in a hesiod
based map.
cheers
mark
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
From: Greg Hudson <ghudson@MIT.EDU>
To: mark@MCS.VUW.AC.NZ
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/10047: amd with hesiod maps sometimes crashing
Date: Fri, 05 May 2000 09:48:33 -0400
(Who's idea was it to look up filenames in Hesiod? Weird.)
> Hi,
> This is actually a hesiod bug but it makes amd core dump.
> a call to hesiod_resolve in the "new style hesiod" (version 3.0.2 at
> least) with a key of the form ".directory.others.u", or any key with
> a leading "." returns NULL but _errno has value 0_.
Yeah, res_mkquery() can't deal with a leading '.' (DNS can't have
empty labels). Some versions of res_mkquery() seem to set errno to
EMSGSIZE, but I guess not NetBSD's (and not the current BIND resolver
version either, looking at source).
I hesitate to check in a libc patch since I'm not set up to test it,
but here is the simple fix. Of course, the EMSGSIZE error string
isn't very intuitive here, but here isn't a better errno code.
*** hesiod.c.old Fri May 5 09:45:46 2000
--- hesiod.c Fri May 5 09:46:04 2000
***************
*** 413,420 ****
/* Construct the query. */
n = res_mkquery(QUERY, name, qclass, T_TXT, NULL, 0,
NULL, qbuf, PACKETSZ);
! if (n < 0)
return NULL;
/* Send the query. */
n = res_send(qbuf, n, abuf, MAX_HESRESP);
--- 413,422 ----
/* Construct the query. */
n = res_mkquery(QUERY, name, qclass, T_TXT, NULL, 0,
NULL, qbuf, PACKETSZ);
! if (n < 0) {
! errno = EMSGSIZE;
return NULL;
+ }
/* Send the query. */
n = res_send(qbuf, n, abuf, MAX_HESRESP);
Responsible-Changed-From-To: bin-bug-people->dogcow
Responsible-Changed-By: fair
Responsible-Changed-When: Tue Jun 6 02:13:56 PDT 2000
Responsible-Changed-Why:
Tom Spindler is doing a new amd import, so a review of relevant PR's
is in order.
From: Mark Davies <mark@MCS.VUW.AC.NZ>
To: Greg Hudson <ghudson@MIT.EDU>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/10047: amd with hesiod maps sometimes crashing
Date: Sun, 18 Jun 2000 15:57:24 +1200
Sorry for the delay in responding to this. I've finally had a chance to build
a system that has this hesiod.c patch in it rather than my amd patch and it
seems to be working and not causing grief to anything else so could someone
please commit the change.
cheers
mark
From: Greg Hudson <ghudson@MIT.EDU>
Date: Fri, 05 May 2000 09:48:33 -0400
> (Who's idea was it to look up filenames in Hesiod? Weird.)
>
> > Hi,
> > This is actually a hesiod bug but it makes amd core dump.
>
> > a call to hesiod_resolve in the "new style hesiod" (version 3.0.2 at
> > least) with a key of the form ".directory.others.u", or any key with
> > a leading "." returns NULL but _errno has value 0_.
>
> Yeah, res_mkquery() can't deal with a leading '.' (DNS can't have
> empty labels). Some versions of res_mkquery() seem to set errno to
> EMSGSIZE, but I guess not NetBSD's (and not the current BIND resolver
> version either, looking at source).
>
> I hesitate to check in a libc patch since I'm not set up to test it,
> but here is the simple fix. Of course, the EMSGSIZE error string
> isn't very intuitive here, but here isn't a better errno code.
>
> *** hesiod.c.old Fri May 5 09:45:46 2000
> --- hesiod.c Fri May 5 09:46:04 2000
> ***************
> *** 413,420 ****
> /* Construct the query. */
> n = res_mkquery(QUERY, name, qclass, T_TXT, NULL, 0,
> NULL, qbuf, PACKETSZ);
> ! if (n < 0)
> return NULL;
>
> /* Send the query. */
> n = res_send(qbuf, n, abuf, MAX_HESRESP);
> --- 413,422 ----
> /* Construct the query. */
> n = res_mkquery(QUERY, name, qclass, T_TXT, NULL, 0,
> NULL, qbuf, PACKETSZ);
> ! if (n < 0) {
> ! errno = EMSGSIZE;
> return NULL;
> + }
>
> /* Send the query. */
> n = res_send(qbuf, n, abuf, MAX_HESRESP);
From: Greg Hudson <ghudson@MIT.EDU>
To: Mark Davies <mark@MCS.VUW.AC.NZ>
Cc: Greg Hudson <ghudson@MIT.EDU>, gnats-bugs@gnats.netbsd.org
Subject: Re: bin/10047: amd with hesiod maps sometimes crashing
Date: Sun, 18 Jun 2000 00:07:22 -0400
Okay, I've checked in the fix.
I'm not going to close the PR on the theory that amd still shouldn't
dump core.
State-Changed-From-To: open->feedback
State-Changed-By: dogcow
State-Changed-When: Fri Feb 21 00:06:36 PST 2003
State-Changed-Why:
Does this problem still occur with the most recent amd?
State-Changed-From-To: feedback->closed
State-Changed-By: perry
State-Changed-When: Fri Apr 4 13:52:46 PST 2003
State-Changed-Why:
The underlying problem was fixed, and there has been no substantive comment
on the PR in about three years.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.