develooper Front page | perl.perl5.porters | Postings from June 2001

Re: [ID 20010630.004] Segfault on gethostbyaddr call which returns multiple PTR records

From:
Nicholas Clark
Date:
June 30, 2001 15:23
Subject:
Re: [ID 20010630.004] Segfault on gethostbyaddr call which returns multiple PTR records
Message ID:
20010630232332.M59620@plum.flirble.org
On Sat, Jun 30, 2001 at 06:12:26PM +0100, Nicholas Clark wrote:
> On Sat, Jun 30, 2001 at 11:14:06AM -0400, Bob Fillmore wrote:
> > 
> > This is a bug report for perl from fillmore@nrn1.nrcan.gc.ca,
> > generated with the help of perlbug 1.28 running under perl v5.6.0.
> > 
> > 
> > -----------------------------------------------------------------
> > [Please enter your report here]
> > 
> > The following code generates a segfault on Solaris 2.6 and Solaris 8:
> > 
> >    $addr = pack('C4', split(/\./,'195.226.128.9'));
> >    $addrtype = 2;
> >    ($name, $rest) = gethostbyaddr($addr, $addrtype);
> 
> FreeBSD on bleadperl goes Bus error (core dumped)
> nd in gdb I get
> 
> (gdb) where
> #0  0x8100e1c in __ns_name_unpack ()
> #1  0x8101081 in __ns_name_uncompress ()
> #2  0x80fb9b1 in __dn_expand ()
> #3  0x80fc7db in irs_dns_ho ()
> #4  0x80fc52b in irs_dns_ho ()
> #5  0x80f4b60 in irs_gen_ho ()
> #6  0x80f0ea7 in gethostbyaddr ()
> #7  0x80ce095 in Perl_pp_ghostent ()
> #8  0x80cdf9f in Perl_pp_ghbyaddr ()
> #9  0x809c3f4 in Perl_runops_standard ()
> #10 0x805fb58 in S_run_body ()
> #11 0x805f898 in perl_run ()
> #12 0x805d3fd in main ()
> #13 0x805d2ed in _start ()
> 
> 
> 5.00502 and 5.6.0 pass, 5.6.1 also goes bus error on bleadperl as far back as
> 8102 (which is the earliest I can find.

Forgot to ask - are you able to run a debugger and get a stack backtrace on
Solaris? It's quite possible that nslookup on Solaris links against different
libraries or is using different code.

I think I know why 5.6.1 on this machine SIGBUSes, 5.6.0 doesn't:

$ ldd /usr/local/bin/perl5.6.0
/usr/local/bin/perl5.6.0:
        libm.so.2 => /usr/lib/libm.so.2 (0x280f8000)
        libc.so.3 => /usr/lib/libc.so.3 (0x28113000)
        libcrypt.so.2 => /usr/lib/libcrypt.so.2 (0x28195000)
$ ldd /usr/local/bin/perl5.6.1
/usr/local/bin/perl5.6.1:
        libm.so.2 => /usr/lib/libm.so.2 (0x28146000)
        libc.so.4 => /usr/lib/libc.so.4 (0x28161000)
        libcrypt.so.2 => /usr/lib/libcrypt.so.2 (0x281f6000)
        libutil.so.3 => /usr/lib/libutil.so.3 (0x2820b000)

Different libc, plus libutil.so, although I don't know what that is.

I suspect that your SEGV on Solaris is actually an OS bug but can't really
prove/disprove this without a backtrace on Solaris.

Something certainly *is* broken with the DNS at the far end, as host here
gives:

host 195.226.128.9
9.128.226.195.IN-ADDR.ARPA domain name pointer www.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer cccars.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer advantage.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer bsi.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer sarkcomputers.sark.net
9.128.226.195.IN-ADDR.ARPA domain name pointer chamberpo.com
9.128.226.195.IN-ADDR.ARPA domain name pointer scatreasury.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer c-photo.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer evans-co.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer swimarathon.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer herring.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer antiquefind.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer gyc.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer ms-consulting.com
9.128.226.195.IN-ADDR.ARPA domain name pointer trainingplus.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer harlequin.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer gybobb.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer gdi.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer osa.guernsey.net
9.128.226.195.IN-ADDR.ARPA domain name pointer 9.128.226.195.IN-ADDR.ARPApacket size error (0x0 != 0xbfbff054)


but it seems that the bug is in the system libraries, not perl, which is
unfortunate, as we can't fix those sort of bugs.
[And worse, I can't see how perl can work round this bug, if it is OS]

Nicholas Clark



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About