From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Jan 13 12:26:34 2005 Return-Path: Delivered-To: freebsd-ports-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5B84A16A4CE; Thu, 13 Jan 2005 12:26:34 +0000 (GMT) Received: from mail.zerouptime.ch (mail.zerouptime.ch [81.6.6.91]) by mx1.FreeBSD.org (Postfix) with ESMTP id B0FAB43D45; Thu, 13 Jan 2005 12:26:33 +0000 (GMT) (envelope-from fireball@zerouptime.ch) Received: from localhost (localhost [127.0.0.1]) by mail.zerouptime.ch (Postfix) with ESMTP id 364F0365; Thu, 13 Jan 2005 13:26:29 +0100 (CET) Received: from mail.zerouptime.ch ([127.0.0.1]) by localhost (mail.zerouptime.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 31300-10; Thu, 13 Jan 2005 13:24:40 +0100 (CET) Received: from localhost (unknown [212.55.210.230]) by mail.zerouptime.ch (Postfix) with ESMTP id F106D87; Thu, 13 Jan 2005 13:24:29 +0100 (CET) Date: Thu, 13 Jan 2005 13:24:25 +0100 From: Jonas Nagel To: Anton Berezin Message-Id: <20050113132425.7dc89730.fireball@zerouptime.ch> In-Reply-To: <20050113095722.GA6034@heechee.tobez.org> References: <200501112101.j0BL1pZ8072388@www.freebsd.org> <200501112110.j0BLACOK089672@freefall.freebsd.org> <20050111222201.6b5a5351.fireball@zerouptime.ch> <20050113095722.GA6034@heechee.tobez.org> X-Mailer: Sylpheed version 0.9.99-gtk2-20041024 (GTK+ 2.4.9; i386-portbld-freebsd5.3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: freebsd-ports-bugs@FreeBSD.org cc: FreeBSD-gnats-submit@FreeBSD.org Subject: Re: ports/76120: [perl] coredump in perl 5.8.5 in malloc()-call from Perl_pp_split() X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jan 2005 12:26:34 -0000 On Thu, 13 Jan 2005 10:57:22 +0100 Anton Berezin wrote: > Jonas, could you maybe re-post a complete minimal script that > reproduces the problem? Otherwise it is a bit cryptic. Of course; actually I thought this question would come but didn't want to completely clutter up the bug report in first place. Here a complete script; I also noticed, that the problem apppears only while I am using the Pcap-Filter function. If I comment setArpFilt() from the code, then it doesn't crash anymore. It appears that the Pcap filter function prepares the packet contents in a way that leads to a crash within the PERL split() function. If there is also a problem in the Pcap code, is another question. I can't see the reason from debug output. #!/usr/local/bin/perl -w use strict; use Net::Pcap; my $err = ""; my $mynet = ""; my $mymask = ""; my $dev = ""; my $pcap_t = ""; my $snaplen = 1024; my $promisc = 1; my $to_ms = 100; my $cnt = -1; my $inst = 1; if(!$ARGV[0]) { die("Specify at least one argument!\n"); } $dev = $ARGV[0]; if(Net::Pcap::lookupnet($dev, \$mynet, \$mymask, \$err)) { die("$err\n"); } print("Network is: ". inet_ntoa($mynet) .", Mask is ". inet_ntoa($mymask) ."\n"); $pcap_t = Net::Pcap::open_live($dev, $snaplen, $promisc, $to_ms, \$err); if(!$pcap_t) { die("$err\n"); } # &setArpFilt($pcap_t, $mymask); Net::Pcap::loop($pcap_t, $cnt, \&display_pkt, $inst); Net::Pcap::close($pcap_t); exit; sub inet_ntoa { return join ".",unpack("CCCC",pack("N",shift)); } sub inet_atoh { return split(//,unpack("H*",pack("CCCC",split(/\./,shift)))); } sub pkt_btoh { my @pkt = (); my $tmp = unpack("H*",shift); my @tmp = split(//,$tmp); my $rng = (scalar(@tmp)/2); for (my $i = 0; $i < $rng; $i++) { $pkt[$i] = shift(@tmp) . shift(@tmp); } return @pkt; } sub display_pkt { my($inst, $hdr, $pkt) = @_; my @pkt = &pkt_btoh($pkt); if (isArpBC(@pkt)) { print("I$inst: $hdr->{'len'} $hdr->{'caplen'} $hdr->{'tv_usec'} - ". join("",@pkt) ."\n"); } } sub setArpFilt { my $pcap_t = shift; my $netmask = shift; my $optimize = 1; my $filter_t = ""; my $filter_str = "arp"; if(Net::Pcap::compile($pcap_t, \$filter_t, $filter_str, $optimize, $netmask)) { die("Net::Pcap::compile returned error: ". Net::Pcap::geterr($pcap_t). "\n"); } if(Net::Pcap::setfilter($pcap_t, $filter_t)) { die("Net::Pcap::setfilter returned error: ". Net::Pcap::geterr($pcap_t). "\n"); } return; } -- Jonas Nagel