Subject: sparc hp->h_addr_list alignment problems
To: itojun@iijlab.net, tron@netbsd.org, Tom Ivar Helbekkmo <tih@Norway.EU.net>
From: David Brownlee <abs@anim.dreamworks.com>
List: tech-net
Date: 07/19/1999 00:00:55
	I've submitted a PR but haven't got a reply yet, but to follow
	up on my own reply (and to set the reply-to to tech-net):

	It does not happen with addresses that are found from the
	resolver, but it does fail for hosts that are found in /etc/hosts
	(not checked YP).

	It looks like src/lib/libc/gethnamaddr.c revision 1.18 introduced
	the problem around line 820 when it malloc()s one block for the
	hostname and (immediately following) addresses.

	If anyone wants a sparc to help them check for this sort of
	thing I can arrange to have one shipped (seriously :)

		David/absolute

	 -=-  "There will not be a send-off, a funeral or mass"  -=-

On Sun, 18 Jul 1999, David Brownlee wrote:

> 	Its not ELF related. After the IPv6 integration it appears that
> 	hp->h_addr_list is no longer suitably aligned for 32bit
> 	access.
> 
> 	Of course on most architectures it doesn't cause the same bus
> 	errors as on sparc. I noticed rarpd was broken in the same way
> 	on the 4th of July and have a patch to work around it.
> 
> 	Given its breaking sendmail as shipped I would think the correct
> 	fix should be in libc somewhere. Will submit a PR.
> 
> 		David/absolute
> 
>   -=-  "Old Red he died, and every single landlord in the district cried"  -=-
> 
> On 16 Jul 1999, Tom Ivar Helbekkmo wrote:
> 
> > After upgrading my SS2 from a -current from three or four months back
> > using the ELF snapshot (quick and easy; a smooth upgrade; thanks!),
> > the only problem I experienced was that the sendmail binary included
> > didn't work -- it just got a "Bus error", and terminated.  I didn't
> > worry too much, since I was planning to move to a current -current
> > using source code anyway.  However, after building the world from the
> > July 11th source tar balls, sendmail still behaves the same way.  The
> > point where it crashes is the snprintf() on line 515 of main.c:
> > 
> > 	snprintf(ipbuf, sizeof ipbuf, "[%.100s]",
> > 		inet_ntoa(*((struct in_addr *) hp->h_addr_list[i])));
> > 
> > Anyone else seeing this?
> > 
> > Incidentally, I took the opportunity to change from sendmail to
> > Postfix, and that was a really positive experience.  I fetched the
> > June 1st version of Postfix, unpacked it, ran 'make', copied the
> > binaries and configuration files into place, spent about 5 minutes
> > configuring it for my SMTP plus UUCP setup, and that was all -- it
> > just works.  The 'mailwrapper' feature of NetBSD helps, of course.
> > 
> > I notice that Wietse Venema has gotten IBM to change the licensing
> > recently -- maybe it's time to integrate Postfix in NetBSD again?
> > Quoting from the release notes from his June 27th snapshot:
> > 
> > 	Postfix is now distributed under IBM Public License Version
> > 	1.0 (June 14, 1999), which does not carry the controversial
> > 	termination clause. The new license does have a requirement
> > 	that contributors make source code available.
> > 
> > While I'm quoting Wietse, here's a gem from the documentation:
> > 
> > 	Postfix takes the usual precautions to avoid loss of
> > 	information: flush and fsync() all data before acknowledging
> > 	receipt, and check all system call results for error
> > 	conditions.  This style of programming may be new to some
> > 	people, but I can assure you that it has been standard
> > 	practice for years in many places.
> > 
> > -tih
> > -- 
> > Popularity is the hallmark of mediocrity.  --Niles Crane, "Frasier"
> > 
> 
>